mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 634747 - Set MediaQueue's to Finished() when we reach end of stream while decoding after seeking and while finding first frame. r=kinetik
This commit is contained in:
parent
6fb059abcc
commit
d18115bb52
@ -81,6 +81,9 @@ VideoData* MediaDecoderReader::DecodeToFirstVideoData()
|
|||||||
bool keyframeSkip = false;
|
bool keyframeSkip = false;
|
||||||
eof = !DecodeVideoFrame(keyframeSkip, 0);
|
eof = !DecodeVideoFrame(keyframeSkip, 0);
|
||||||
}
|
}
|
||||||
|
if (eof) {
|
||||||
|
VideoQueue().Finish();
|
||||||
|
}
|
||||||
VideoData* d = nullptr;
|
VideoData* d = nullptr;
|
||||||
return (d = VideoQueue().PeekFront()) ? d : nullptr;
|
return (d = VideoQueue().PeekFront()) ? d : nullptr;
|
||||||
}
|
}
|
||||||
@ -97,6 +100,9 @@ AudioData* MediaDecoderReader::DecodeToFirstAudioData()
|
|||||||
}
|
}
|
||||||
eof = !DecodeAudioData();
|
eof = !DecodeAudioData();
|
||||||
}
|
}
|
||||||
|
if (eof) {
|
||||||
|
AudioQueue().Finish();
|
||||||
|
}
|
||||||
AudioData* d = nullptr;
|
AudioData* d = nullptr;
|
||||||
return (d = AudioQueue().PeekFront()) ? d : nullptr;
|
return (d = AudioQueue().PeekFront()) ? d : nullptr;
|
||||||
}
|
}
|
||||||
@ -155,11 +161,12 @@ nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (VideoQueue().GetSize() == 0) {
|
if (eof) {
|
||||||
// Hit end of file, we want to display the last frame of the video.
|
// Hit end of file, we want to display the last frame of the video.
|
||||||
if (video) {
|
if (video) {
|
||||||
VideoQueue().PushFront(video.forget());
|
VideoQueue().PushFront(video.forget());
|
||||||
}
|
}
|
||||||
|
VideoQueue().Finish();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
video = VideoQueue().PeekFront();
|
video = VideoQueue().PeekFront();
|
||||||
@ -198,8 +205,10 @@ nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const AudioData* audio = AudioQueue().PeekFront();
|
const AudioData* audio = AudioQueue().PeekFront();
|
||||||
if (!audio)
|
if (!audio || eof) {
|
||||||
|
AudioQueue().Finish();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
CheckedInt64 startFrame = UsecsToFrames(audio->mTime, mInfo.mAudio.mRate);
|
CheckedInt64 startFrame = UsecsToFrames(audio->mTime, mInfo.mAudio.mRate);
|
||||||
CheckedInt64 targetFrame = UsecsToFrames(aTarget, mInfo.mAudio.mRate);
|
CheckedInt64 targetFrame = UsecsToFrames(aTarget, mInfo.mAudio.mRate);
|
||||||
if (!startFrame.isValid() || !targetFrame.isValid()) {
|
if (!startFrame.isValid() || !targetFrame.isValid()) {
|
||||||
|
@ -1799,17 +1799,19 @@ void MediaDecoderStateMachine::DecodeSeek()
|
|||||||
}
|
}
|
||||||
if (NS_SUCCEEDED(res)) {
|
if (NS_SUCCEEDED(res)) {
|
||||||
AudioData* audio = HasAudio() ? mReader->AudioQueue().PeekFront() : nullptr;
|
AudioData* audio = HasAudio() ? mReader->AudioQueue().PeekFront() : nullptr;
|
||||||
NS_ASSERTION(!audio || (audio->mTime <= seekTime &&
|
MOZ_ASSERT(!audio ||
|
||||||
seekTime <= audio->mTime + audio->mDuration),
|
(audio->mTime <= seekTime &&
|
||||||
"Seek target should lie inside the first audio block after seek");
|
seekTime <= audio->mTime + audio->mDuration) ||
|
||||||
|
mReader->AudioQueue().IsFinished(),
|
||||||
|
"Seek target should lie inside the first audio block after seek");
|
||||||
int64_t startTime = (audio && audio->mTime < seekTime) ? audio->mTime : seekTime;
|
int64_t startTime = (audio && audio->mTime < seekTime) ? audio->mTime : seekTime;
|
||||||
mAudioStartTime = startTime;
|
mAudioStartTime = startTime;
|
||||||
mPlayDuration = startTime - mStartTime;
|
mPlayDuration = startTime - mStartTime;
|
||||||
if (HasVideo()) {
|
if (HasVideo()) {
|
||||||
VideoData* video = mReader->VideoQueue().PeekFront();
|
VideoData* video = mReader->VideoQueue().PeekFront();
|
||||||
if (video) {
|
if (video) {
|
||||||
NS_ASSERTION((video->mTime <= seekTime && seekTime <= video->GetEndTime()) ||
|
MOZ_ASSERT((video->mTime <= seekTime && seekTime <= video->GetEndTime()) ||
|
||||||
mReader->VideoQueue().IsFinished(),
|
mReader->VideoQueue().IsFinished(),
|
||||||
"Seek target should lie inside the first frame after seek, unless it's the last frame.");
|
"Seek target should lie inside the first frame after seek, unless it's the last frame.");
|
||||||
{
|
{
|
||||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||||
|
@ -15,11 +15,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=495300
|
|||||||
<pre id="test">
|
<pre id="test">
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
|
|
||||||
if (!navigator.platform.startsWith("Mac")) {
|
|
||||||
// not Mac
|
|
||||||
SimpleTest.expectAssertions(0, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
var manager = new MediaTestManager;
|
var manager = new MediaTestManager;
|
||||||
|
|
||||||
function filename(uri) {
|
function filename(uri) {
|
||||||
|
Loading…
Reference in New Issue
Block a user