Bug 1298594 - P4. Pop the frame when current time is past the end of the current frame. r=jwwang, a=ritu
Most frames start when the previous one stop.
MozReview-Commit-ID: H92Bmiki49Q
--- a/dom/media/mediasink/VideoSink.cpp
+++ b/dom/media/mediasink/VideoSink.cpp
@@ -390,17 +390,17 @@ VideoSink::UpdateRenderedVideoFrames()
// Get the current playback position.
TimeStamp nowTime;
const int64_t clockTime = mAudioSink->GetPosition(&nowTime);
NS_ASSERTION(clockTime >= 0, "Should have positive clock time.");
// Skip frames up to the playback position.
int64_t lastDisplayedFrameEndTime = 0;
while (VideoQueue().GetSize() > 0 &&
- clockTime > VideoQueue().PeekFront()->GetEndTime()) {
+ clockTime >= VideoQueue().PeekFront()->GetEndTime()) {
RefPtr<MediaData> frame = VideoQueue().PopFront();
if (frame->As<VideoData>()->mSentToCompositor) {
lastDisplayedFrameEndTime = frame->GetEndTime();
mFrameStats.NotifyPresentedFrame();
} else {
mFrameStats.NotifyDecodedFrames({ 0, 0, 1 });
VSINK_LOG_V("discarding video frame mTime=%lld clock_time=%lld",
frame->mTime, clockTime);