Bug 991448 - Skip Theora decode to next keyframe after seek, so that we don't get visual artifacts after a fastSeek. r=cajbir

This commit is contained in:
Chris Pearce 2014-04-04 10:39:15 +13:00
Родитель 1e5a6da82f
Коммит ca5f79e5a8
2 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -1379,6 +1379,28 @@ nsresult OggReader::Seek(int64_t aTarget,
}
}
if (HasVideo()) {
// Decode forwards until we find the next keyframe. This is required,
// as although the seek should finish on a page containing a keyframe,
// there may be non-keyframes in the page before the keyframe.
// When doing fastSeek we display the first frame after the seek, so
// we need to advance the decode to the keyframe otherwise we'll get
// visual artifacts in the first frame output after the seek.
bool skip = true;
while (DecodeVideoFrame(skip, 0) && skip) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
if (mDecoder->IsShutdown()) {
return NS_ERROR_FAILURE;
}
}
#ifdef DEBUG
const VideoData* v = mVideoQueue.PeekFront();
if (!v || !v->mKeyframe) {
NS_WARNING("Ogg seek didn't end up before a key frame!");
}
#endif
}
return NS_OK;
}

Просмотреть файл

@ -356,7 +356,10 @@ var gFastSeekTests = [
{ name:"gizmo.mp4", type:"video/mp4", keyframes:[0, 1.0, 2.0, 3.0, 4.0, 5.0 ] },
// Note: Not all keyframes in the file are actually referenced in the Cues in this file.
{ name:"seek.webm", type:"video/webm", keyframes:[0, 0.8, 1.6, 2.4, 3.2]},
// Note: omitting Ogg from this test, as I'm not sure our Ogg seek code is optimal/correct - cpearce
// Note: the sync points are the points on both the audio and video streams
// before the keyframes. You can't just assume that the keyframes are the sync
// points, as the audio required for that sync point may be before the keyframe.
{ name:"bug516323.indexed.ogv", type:"video/ogg", keyframes:[0, 0.46, 3.06] },
];
function IsWindows8OrLater() {