Bug 1380234. P2 - send compositor updates to the reader directly without using MediaEventSource. r=jya

MozReview-Commit-ID: EJO2PK525gS

--HG--
extra : rebase_source : 11a033d2e6a94b307ca8095b2ffd7348edb2b6d4
extra : source : 44c52998638933e8b709fa5196ef442314145d2f
This commit is contained in:
JW Wang 2017-07-12 16:28:19 +08:00
Родитель 4ca981216d
Коммит 803c5fa941
4 изменённых файлов: 20 добавлений и 12 удалений

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

@ -1075,7 +1075,14 @@ MediaDecoder::NotifyCompositor()
{
RefPtr<KnowsCompositor> knowsCompositor = GetCompositor();
if (knowsCompositor) {
mCompositorUpdatedEvent.Notify(knowsCompositor);
nsCOMPtr<nsIRunnable> r =
NewRunnableMethod<already_AddRefed<KnowsCompositor>&&>(
"MediaDecoderReader::UpdateCompositor",
mReader,
&MediaDecoderReader::UpdateCompositor,
knowsCompositor.forget());
mReader->OwnerThread()->Dispatch(r.forget(),
AbstractThread::DontAssertDispatchSuccess);
}
}

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

@ -135,6 +135,8 @@ public:
void UpdateDuration(const media::TimeUnit& aDuration);
virtual void UpdateCompositor(already_AddRefed<layers::KnowsCompositor>) {}
// Resets all state related to decoding, emptying all buffers etc.
// Cancels all pending Request*Data() request callbacks, rejects any
// outstanding seek promises, and flushes the decode pipeline. The

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

@ -1115,12 +1115,6 @@ MediaFormatReader::MediaFormatReader(MediaDecoderReaderInit& aInit,
{
MOZ_ASSERT(aDemuxer);
MOZ_COUNT_CTOR(MediaFormatReader);
AbstractMediaDecoder* decoder = aInit.mDecoder;
if (decoder && decoder->CompositorUpdatedEvent()) {
mCompositorUpdatedListener = decoder->CompositorUpdatedEvent()->Connect(
mTaskQueue, this, &MediaFormatReader::NotifyCompositorUpdated);
}
mOnTrackWaitingForKeyListener = OnTrackWaitingForKey().Connect(
mTaskQueue, this, &MediaFormatReader::NotifyWaitingForKey);
}
@ -3117,6 +3111,14 @@ MediaFormatReader::SetVideoNullDecode(bool aIsNullDecode)
return SetNullDecode(TrackType::kVideoTrack, aIsNullDecode);
}
void
MediaFormatReader::UpdateCompositor(
already_AddRefed<layers::KnowsCompositor> aCompositor)
{
MOZ_ASSERT(OnTaskQueue());
mKnowsCompositor = aCompositor;
}
void
MediaFormatReader::SetNullDecode(TrackType aTrack, bool aIsNullDecode)
{

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

@ -79,6 +79,8 @@ public:
void SetVideoNullDecode(bool aIsNullDecode) override;
void UpdateCompositor(already_AddRefed<layers::KnowsCompositor>) override;
private:
nsresult InitInternal() override;
@ -520,11 +522,6 @@ private:
void OnVideoSeekFailed(const MediaResult& aError);
bool mSeekScheduled;
void NotifyCompositorUpdated(RefPtr<layers::KnowsCompositor> aKnowsCompositor)
{
mKnowsCompositor = aKnowsCompositor.forget();
}
void DoAudioSeek();
void OnAudioSeekCompleted(media::TimeUnit aTime);
void OnAudioSeekFailed(const MediaResult& aError);