Bug 1050060 - Fix MP4 range pinning; r=edwin

This commit is contained in:
Anthony Jones 2014-08-13 17:13:28 +12:00
parent 2c2bccb36d
commit fa358b339a

View File

@ -758,12 +758,14 @@ void
MP4Reader::UpdateIndex()
{
nsTArray<MediaByteRange> ranges;
if (NS_FAILED(mDecoder->GetResource()->GetCachedRanges(ranges))) {
return;
}
nsTArray<Interval<Microseconds>> timeRanges;
mDemuxer->ConvertByteRangesToTime(ranges, &timeRanges);
MediaResource* resource = mDecoder->GetResource();
resource->Pin();
if (NS_SUCCEEDED(resource->GetCachedRanges(ranges))) {
mDemuxer->ConvertByteRangesToTime(ranges, &timeRanges);
}
resource->Unpin();
MonitorAutoLock mon(mTimeRangesMonitor);
mTimeRanges = timeRanges;