mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1128332: Part2. Don't consider decoding error as fatal. r=mattwoodrow
A decoding error may be temporary. In particular should the range removal algorithm be called while attempting to demux frames about to be evicted.
This commit is contained in:
parent
8154405d16
commit
a6ad87ea37
@ -236,20 +236,20 @@ MediaSourceReader::OnAudioNotDecoded(NotDecodedReason aReason)
|
||||
mAudioRequest.Complete();
|
||||
|
||||
MSE_DEBUG("aReason=%u IsEnded: %d", aReason, IsEnded());
|
||||
if (aReason == DECODE_ERROR || aReason == CANCELED) {
|
||||
mAudioPromise.Reject(aReason, __func__);
|
||||
if (aReason == CANCELED) {
|
||||
mAudioPromise.Reject(CANCELED, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
// End of stream. Force switching past this stream to another reader by
|
||||
// If End of stream. Force switching past this stream to another reader by
|
||||
// switching to the end of the buffered range.
|
||||
MOZ_ASSERT(aReason == END_OF_STREAM);
|
||||
if (mAudioSourceDecoder) {
|
||||
if (aReason == END_OF_STREAM && mAudioSourceDecoder) {
|
||||
AdjustEndTime(&mLastAudioTime, mAudioSourceDecoder);
|
||||
}
|
||||
|
||||
SwitchSourceResult result = SwitchAudioSource(&mLastAudioTime);
|
||||
// See if we can find a different source that can pick up where we left off.
|
||||
if (SwitchAudioSource(&mLastAudioTime) == SOURCE_NEW) {
|
||||
if (result == SOURCE_NEW) {
|
||||
GetAudioReader()->ResetDecode();
|
||||
mAudioSeekRequest.Begin(GetAudioReader()->Seek(GetReaderAudioTime(mLastAudioTime), 0)
|
||||
->RefableThen(GetTaskQueue(), __func__, this,
|
||||
@ -258,6 +258,15 @@ MediaSourceReader::OnAudioNotDecoded(NotDecodedReason aReason)
|
||||
return;
|
||||
}
|
||||
|
||||
// If we got a DECODE_ERROR and we have buffered data in the requested range
|
||||
// then it must be a genuine decoding error.
|
||||
// Otherwise we can assume that the data was either evicted or explicitely
|
||||
// removed from the source buffer and we should wait for new data.
|
||||
if (aReason == DECODE_ERROR && result != SOURCE_NONE) {
|
||||
mAudioPromise.Reject(DECODE_ERROR, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
CheckForWaitOrEndOfStream(MediaData::AUDIO_DATA, mLastAudioTime);
|
||||
}
|
||||
|
||||
@ -367,20 +376,21 @@ MediaSourceReader::OnVideoNotDecoded(NotDecodedReason aReason)
|
||||
mVideoRequest.Complete();
|
||||
|
||||
MSE_DEBUG("aReason=%u IsEnded: %d", aReason, IsEnded());
|
||||
if (aReason == DECODE_ERROR || aReason == CANCELED) {
|
||||
mVideoPromise.Reject(aReason, __func__);
|
||||
|
||||
if (aReason == CANCELED) {
|
||||
mVideoPromise.Reject(CANCELED, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
// End of stream. Force switching past this stream to another reader by
|
||||
// if End of stream. Force switching past this stream to another reader by
|
||||
// switching to the end of the buffered range.
|
||||
MOZ_ASSERT(aReason == END_OF_STREAM);
|
||||
if (mVideoSourceDecoder) {
|
||||
if (aReason == END_OF_STREAM && mVideoSourceDecoder) {
|
||||
AdjustEndTime(&mLastVideoTime, mVideoSourceDecoder);
|
||||
}
|
||||
|
||||
// See if we can find a different reader that can pick up where we left off.
|
||||
if (SwitchVideoSource(&mLastVideoTime) == SOURCE_NEW) {
|
||||
SwitchSourceResult result = SwitchVideoSource(&mLastVideoTime);
|
||||
if (result == SOURCE_NEW) {
|
||||
GetVideoReader()->ResetDecode();
|
||||
mVideoSeekRequest.Begin(GetVideoReader()->Seek(GetReaderVideoTime(mLastVideoTime), 0)
|
||||
->RefableThen(GetTaskQueue(), __func__, this,
|
||||
@ -389,6 +399,15 @@ MediaSourceReader::OnVideoNotDecoded(NotDecodedReason aReason)
|
||||
return;
|
||||
}
|
||||
|
||||
// If we got a DECODE_ERROR and we have buffered data in the requested range
|
||||
// then it must be a genuine decoding error.
|
||||
// Otherwise we can assume that the data was either evicted or explicitely
|
||||
// removed from the source buffer and we should wait for new data.
|
||||
if (aReason == DECODE_ERROR && result != SOURCE_NONE) {
|
||||
mVideoPromise.Reject(DECODE_ERROR, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
CheckForWaitOrEndOfStream(MediaData::VIDEO_DATA, mLastVideoTime);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user