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:
Jonathan Thomas
2016-01-30 02:10:40 -06:00
parent 45a4269a1e
commit 43fd4fccb1
3 changed files with 2 additions and 4 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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);