diff options
-rw-r--r-- | media/filters/ffmpeg_video_decoder.cc | 3 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder_unittest.cc | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index 716c60d..4496505 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -224,6 +224,9 @@ FFmpegVideoDecoder::TimeTuple FFmpegVideoDecoder::FindPtsAndDuration( if (timestamp != StreamSample::kInvalidTimestamp && timestamp.ToInternalValue() != 0) { pts.timestamp = timestamp; + // We need to clean up the timestamp we pushed onto the |pts_heap|. + if (!pts_heap->IsEmpty()) + pts_heap->Pop(); } else if (!pts_heap->IsEmpty()) { // If the frame did not have pts, try to get the pts from the |pts_heap|. pts.timestamp = pts_heap->Top(); diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index 33b7f5a..228d3c8 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc @@ -344,6 +344,7 @@ TEST_F(FFmpegVideoDecoderTest, FindPtsAndDuration) { // Set a pts and duration on |video_frame_| and make sure it overrides // |pts_heap|. + pts_heap.Push(base::TimeDelta::FromMicroseconds(123)); video_frame_->SetTimestamp(base::TimeDelta::FromMicroseconds(456)); video_frame_->SetDuration(base::TimeDelta::FromMicroseconds(789)); result_pts = decoder_->FindPtsAndDuration(time_base, |