Bug 1119119: Do not abort when calling appendBuffer with no data. r=cajbir

--HG--
extra : rebase_source : 4836370af1e1558771700331d40d2312cd225201
This commit is contained in:
Jean-Yves Avenard 2015-01-16 23:48:24 +11:00
parent 800dac5fb8
commit 5f8c15040b

View File

@ -347,19 +347,21 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
MOZ_ASSERT(mAppendMode == SourceBufferAppendMode::Segments,
"We don't handle timestampOffset for sequence mode yet");
if (!mTrackBuffer->AppendData(aData, aLength, mTimestampOffset * USECS_PER_S)) {
Optional<MediaSourceEndOfStreamError> decodeError(MediaSourceEndOfStreamError::Decode);
ErrorResult dummy;
mMediaSource->EndOfStream(decodeError, dummy);
aRv.Throw(NS_ERROR_FAILURE);
return;
}
if (aLength) {
if (!mTrackBuffer->AppendData(aData, aLength, mTimestampOffset * USECS_PER_S)) {
Optional<MediaSourceEndOfStreamError> decodeError(MediaSourceEndOfStreamError::Decode);
ErrorResult dummy;
mMediaSource->EndOfStream(decodeError, dummy);
aRv.Throw(NS_ERROR_FAILURE);
return;
}
if (mTrackBuffer->HasInitSegment()) {
mMediaSource->QueueInitializationEvent();
}
if (mTrackBuffer->HasInitSegment()) {
mMediaSource->QueueInitializationEvent();
}
CheckEndTime();
CheckEndTime();
}
// Run the final step of the buffer append algorithm asynchronously to
// ensure the SourceBuffer's updating flag transition behaves as required