Bug 1313497 - Use InvokeAsync with Storages in MediaSourceDemuxer - r=jya

We now take a copy of the TimeUnit object, and can then pass it by rref to
internal methods.

MozReview-Commit-ID: J0Idw85NMcu

--HG--
extra : rebase_source : 9cb8dd45ff7b449074121df8618ee7295398138b
This commit is contained in:
Gerald Squelart 2016-11-13 12:03:26 +11:00
Родитель 8f286c5e0c
Коммит 25b7c80fa4
2 изменённых файлов: 11 добавлений и 9 удалений

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

@ -307,8 +307,9 @@ RefPtr<MediaSourceTrackDemuxer::SeekPromise>
MediaSourceTrackDemuxer::Seek(media::TimeUnit aTime)
{
MOZ_ASSERT(mParent, "Called after BreackCycle()");
return InvokeAsync(mParent->GetTaskQueue(), this, __func__,
&MediaSourceTrackDemuxer::DoSeek, aTime);
return InvokeAsync<media::TimeUnit&&>(
mParent->GetTaskQueue(), this, __func__,
&MediaSourceTrackDemuxer::DoSeek, aTime);
}
RefPtr<MediaSourceTrackDemuxer::SamplesPromise>
@ -350,9 +351,10 @@ MediaSourceTrackDemuxer::GetNextRandomAccessPoint(media::TimeUnit* aTime)
RefPtr<MediaSourceTrackDemuxer::SkipAccessPointPromise>
MediaSourceTrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
{
return InvokeAsync(mParent->GetTaskQueue(), this, __func__,
&MediaSourceTrackDemuxer::DoSkipToNextRandomAccessPoint,
aTimeThreshold);
return InvokeAsync<media::TimeUnit&&>(
mParent->GetTaskQueue(), this, __func__,
&MediaSourceTrackDemuxer::DoSkipToNextRandomAccessPoint,
aTimeThreshold);
}
media::TimeIntervals
@ -374,7 +376,7 @@ MediaSourceTrackDemuxer::BreakCycles()
}
RefPtr<MediaSourceTrackDemuxer::SeekPromise>
MediaSourceTrackDemuxer::DoSeek(media::TimeUnit aTime)
MediaSourceTrackDemuxer::DoSeek(const media::TimeUnit& aTime)
{
TimeIntervals buffered = mManager->Buffered(mType);
// Fuzz factor represents a +/- threshold. So when seeking it allows the gap
@ -469,7 +471,7 @@ MediaSourceTrackDemuxer::DoGetSamples(int32_t aNumSamples)
}
RefPtr<MediaSourceTrackDemuxer::SkipAccessPointPromise>
MediaSourceTrackDemuxer::DoSkipToNextRandomAccessPoint(media::TimeUnit aTimeThreadshold)
MediaSourceTrackDemuxer::DoSkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreadshold)
{
uint32_t parsed = 0;
// Ensure that the data we are about to skip to is still available.

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

@ -116,9 +116,9 @@ public:
}
private:
RefPtr<SeekPromise> DoSeek(media::TimeUnit aTime);
RefPtr<SeekPromise> DoSeek(const media::TimeUnit& aTime);
RefPtr<SamplesPromise> DoGetSamples(int32_t aNumSamples);
RefPtr<SkipAccessPointPromise> DoSkipToNextRandomAccessPoint(media::TimeUnit aTimeThreadshold);
RefPtr<SkipAccessPointPromise> DoSkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreadshold);
already_AddRefed<MediaRawData> GetSample(MediaResult& aError);
// Return the timestamp of the next keyframe after mLastSampleIndex.
media::TimeUnit GetNextRandomAccessPoint();