You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fixing an audio popping / video frame flashing issue with the Timeline calculating the incorrect frame from a Clip. Now the timeline correctly rounds the time diff, and determines the correct frame.
This commit is contained in:
@@ -374,8 +374,6 @@ tr1::shared_ptr<Frame> FrameMapper::GetFrame(long int requested_frame) throw(Rea
|
||||
if (final_frame) return final_frame;
|
||||
|
||||
// Minimum number of frames to process (for performance reasons)
|
||||
// TODO: Find a safe way to deal with Closing the reader while multi-processing is happening
|
||||
// In the meantime, I'm leaving this at 1
|
||||
int minimum_frames = OPEN_MP_NUM_PROCESSORS;
|
||||
|
||||
// Set the number of threads in OpenMP
|
||||
|
||||
@@ -57,7 +57,7 @@ void QtPlayer::SetSource(const std::string &source)
|
||||
{
|
||||
FFmpegReader *ffreader = new FFmpegReader(source);
|
||||
ffreader->debug = false;
|
||||
ffreader->Open();
|
||||
ffreader->DisplayInfo();
|
||||
|
||||
//reader = new FrameMapper(ffreader, ffreader->info.fps, PULLDOWN_NONE, ffreader->info.sample_rate, ffreader->info.channels, ffreader->info.channel_layout);
|
||||
reader = new Timeline(ffreader->info.width, ffreader->info.height, ffreader->info.fps, ffreader->info.sample_rate, ffreader->info.channels, ffreader->info.channel_layout);
|
||||
|
||||
@@ -664,7 +664,7 @@ tr1::shared_ptr<Frame> Timeline::GetFrame(long int requested_frame) throw(Reader
|
||||
|
||||
// Determine the frame needed for this clip (based on the position on the timeline)
|
||||
float time_diff = (requested_time - clip->Position()) + clip->Start();
|
||||
int clip_frame_number = (time_diff * info.fps.ToFloat()) + 1;
|
||||
int clip_frame_number = round(time_diff * info.fps.ToFloat()) + 1;
|
||||
|
||||
// Debug output
|
||||
AppendDebugMethod("Timeline::GetFrame (Calculate clip's frame #)", "time_diff", time_diff, "requested_time", requested_time, "clip->Position()", clip->Position(), "clip->Start()", clip->Start(), "info.fps.ToFloat()", info.fps.ToFloat(), "clip_frame_number", clip_frame_number);
|
||||
|
||||
Reference in New Issue
Block a user