Bug 1050060 - Update index off main thread; r=edwin

This commit is contained in:
Anthony Jones 2014-08-13 17:13:28 +12:00
Родитель ae0690b0eb
Коммит 4f53a7c1a6
2 изменённых файлов: 13 добавлений и 0 удалений

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

@ -744,6 +744,18 @@ MP4Reader::Seek(int64_t aTime,
void
MP4Reader::NotifyDataArrived(const char* aBuffer, uint32_t aLength,
int64_t aOffset)
{
if (NS_IsMainThread()) {
MediaTaskQueue* queue =
mAudio.mTaskQueue ? mAudio.mTaskQueue : mVideo.mTaskQueue;
queue->Dispatch(NS_NewRunnableMethod(this, &MP4Reader::UpdateIndex));
} else {
UpdateIndex();
}
}
void
MP4Reader::UpdateIndex()
{
nsTArray<MediaByteRange> ranges;
if (NS_FAILED(mDecoder->GetResource()->GetCachedRanges(ranges))) {

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

@ -86,6 +86,7 @@ private:
bool Decode(mp4_demuxer::TrackType aTrack);
void Flush(mp4_demuxer::TrackType aTrack);
void DrainComplete(mp4_demuxer::TrackType aTrack);
void UpdateIndex();
void NotifyResourcesStatusChanged();
bool IsWaitingOnCodecResource();
bool IsWaitingOnCDMResource();