Bug 1165825 - 1. Release the buffer which contains INFO_FORMAT_CHANGED. 2. Re-trigger the decode task if we still hold a promise. r=sotaro

--HG--
extra : rebase_source : 109dfea3be7cd8333a82aad72fce588e3267a133
This commit is contained in:
Benjamin Chen 2015-06-02 15:03:06 +08:00
Родитель 046a61300c
Коммит 26b1a24fe5
1 изменённых файлов: 9 добавлений и 1 удалений

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

@ -458,6 +458,8 @@ MediaCodecReader::DecodeAudioDataTask()
}
} else if (AudioQueue().AtEndOfStream()) {
mAudioTrack.mAudioPromise.Reject(END_OF_STREAM, __func__);
} else if (AudioQueue().GetSize() == 0) {
DispatchAudioTask();
}
}
@ -466,6 +468,9 @@ MediaCodecReader::DecodeVideoFrameTask(int64_t aTimeThreshold)
{
DecodeVideoFrameSync(aTimeThreshold);
MonitorAutoLock al(mVideoTrack.mTrackMonitor);
if (mVideoTrack.mVideoPromise.IsEmpty()) {
return;
}
if (VideoQueue().GetSize() > 0) {
nsRefPtr<VideoData> v = VideoQueue().PopFront();
if (v) {
@ -477,6 +482,8 @@ MediaCodecReader::DecodeVideoFrameTask(int64_t aTimeThreshold)
}
} else if (VideoQueue().AtEndOfStream()) {
mVideoTrack.mVideoPromise.Reject(END_OF_STREAM, __func__);
} else if (VideoQueue().GetSize() == 0) {
DispatchVideoTask(aTimeThreshold);
}
}
@ -1830,7 +1837,7 @@ MediaCodecReader::GetCodecOutputData(Track& aTrack,
if (status == OK) {
// Notify mDecoder that we have parsed a video frame.
if (&aTrack == &mVideoTrack) {
if (aTrack.mType == Track::kVideo) {
mDecoder->NotifyDecodedFrames(1, 0, 0);
}
if (!IsValidTimestampUs(aThreshold) || info.mTimeUs >= aThreshold) {
@ -1905,6 +1912,7 @@ MediaCodecReader::EnsureCodecFormatParsed(Track& aTrack)
}
FillCodecInputData(aTrack);
}
aTrack.mCodec->releaseOutputBuffer(index);
return aTrack.mCodec->getOutputFormat(&format) == OK;
}