Bug 1120247 - 1 MediaCodecReader::ResetDecode() needs to reject(cancel) any pending promises. 2. fix regression caused by bug 1114910. r=cpearce

This commit is contained in:
Benjamin Chen 2015-01-20 14:46:31 +08:00
Родитель 3584ed3e5f
Коммит 8e5e324b89
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -758,12 +758,20 @@ nsresult
MediaCodecReader::ResetDecode() MediaCodecReader::ResetDecode()
{ {
if (CheckAudioResources()) { if (CheckAudioResources()) {
mAudioTrack.mTaskQueue->AwaitIdle(); mAudioTrack.mTaskQueue->Flush();
MonitorAutoLock al(mAudioTrack.mTrackMonitor);
if (!mAudioTrack.mAudioPromise.IsEmpty()) {
mAudioTrack.mAudioPromise.Reject(CANCELED, __func__);
}
FlushCodecData(mAudioTrack); FlushCodecData(mAudioTrack);
mAudioTrack.mDiscontinuity = true; mAudioTrack.mDiscontinuity = true;
} }
if (CheckVideoResources()) { if (CheckVideoResources()) {
mVideoTrack.mTaskQueue->AwaitIdle(); mVideoTrack.mTaskQueue->Flush();
MonitorAutoLock al(mVideoTrack.mTrackMonitor);
if (!mVideoTrack.mVideoPromise.IsEmpty()) {
mVideoTrack.mVideoPromise.Reject(CANCELED, __func__);
}
FlushCodecData(mVideoTrack); FlushCodecData(mVideoTrack);
mVideoTrack.mDiscontinuity = true; mVideoTrack.mDiscontinuity = true;
} }