Bug 686957 - Display final frame of video when seeking to end - r=kinetik

--HG--
extra : rebase_source : 4ba333f6de5d287f1b37cee7b4b34adb93bb4e85
This commit is contained in:
Chris Double 2011-09-30 17:15:24 +13:00
parent 9428953bf6
commit 9334ce67bf

View File

@ -267,6 +267,7 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(PRInt64 aTarget)
if (HasVideo()) {
bool eof = false;
PRInt64 startTime = -1;
nsAutoPtr<VideoData> video;
while (HasVideo() && !eof) {
while (mVideoQueue.GetSize() == 0 && !eof) {
bool skip = false;
@ -279,9 +280,13 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(PRInt64 aTarget)
}
}
if (mVideoQueue.GetSize() == 0) {
// Hit end of file, we want to display the last frame of the video.
if (video) {
mVideoQueue.PushFront(video.forget());
}
break;
}
nsAutoPtr<VideoData> video(mVideoQueue.PeekFront());
video = mVideoQueue.PeekFront();
// If the frame end time is less than the seek target, we won't want
// to display this frame after the seek, so discard it.
if (video && video->mEndTime <= aTarget) {
@ -289,7 +294,6 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(PRInt64 aTarget)
startTime = video->mTime;
}
mVideoQueue.PopFront();
video = nsnull;
} else {
video.forget();
break;