mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1188238: [MSE] P2. Don't assert when unable to find position in frames array. r=gerald
Instead return an error which will terminate the video element.
This commit is contained in:
parent
506d208f9e
commit
21d2f1de2a
@ -1568,19 +1568,19 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
TrackBuffersManager::CheckNextInsertionIndex(TrackData& aTrackData,
|
||||
const TimeUnit& aSampleTime)
|
||||
{
|
||||
if (aTrackData.mNextInsertionIndex.isSome()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
TrackBuffer& data = aTrackData.mBuffers.LastElement();
|
||||
|
||||
if (data.IsEmpty() || aSampleTime < aTrackData.mBufferedRanges.GetStart()) {
|
||||
aTrackData.mNextInsertionIndex = Some(size_t(0));
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find which discontinuity we should insert the frame before.
|
||||
@ -1594,17 +1594,20 @@ TrackBuffersManager::CheckNextInsertionIndex(TrackData& aTrackData,
|
||||
if (target.IsEmpty()) {
|
||||
// No target found, it will be added at the end of the track buffer.
|
||||
aTrackData.mNextInsertionIndex = Some(data.Length());
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
// We now need to find the first frame of the searched interval.
|
||||
// We will insert our new frames right before.
|
||||
for (uint32_t i = 0; i < data.Length(); i++) {
|
||||
const nsRefPtr<MediaRawData>& sample = data[i];
|
||||
if (sample->mTime >= target.mStart.ToMicroseconds() ||
|
||||
sample->GetEndTime() > target.mStart.ToMicroseconds()) {
|
||||
aTrackData.mNextInsertionIndex = Some(size_t(i));
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
MOZ_CRASH("Insertion Index Not Found");
|
||||
NS_ASSERTION(false, "Insertion Index Not Found");
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1650,8 +1653,11 @@ TrackBuffersManager::InsertFrames(TrackBuffer& aSamples,
|
||||
}
|
||||
|
||||
// 16. Add the coded frame with the presentation timestamp, decode timestamp, and frame duration to the track buffer.
|
||||
CheckNextInsertionIndex(aTrackData,
|
||||
TimeUnit::FromMicroseconds(aSamples[0]->mTime));
|
||||
if (!CheckNextInsertionIndex(aTrackData,
|
||||
TimeUnit::FromMicroseconds(aSamples[0]->mTime))) {
|
||||
RejectProcessing(NS_ERROR_FAILURE, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust our demuxing index if necessary.
|
||||
if (trackBuffer.mNextGetSampleIndex.isSome() &&
|
||||
|
@ -282,7 +282,7 @@ private:
|
||||
|
||||
void CheckSequenceDiscontinuity();
|
||||
void ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData);
|
||||
void CheckNextInsertionIndex(TrackData& aTrackData,
|
||||
bool CheckNextInsertionIndex(TrackData& aTrackData,
|
||||
const media::TimeUnit& aSampleTime);
|
||||
void InsertFrames(TrackBuffer& aSamples,
|
||||
const media::TimeIntervals& aIntervals,
|
||||
|
Loading…
Reference in New Issue
Block a user