Bug 1378316. P3 - remove AbstractMediaDecoder::DataArrivedEvent() and related code.
MozReview-Commit-ID: 5V3RANftFe5
--- a/dom/media/AbstractMediaDecoder.h
+++ b/dom/media/AbstractMediaDecoder.h
@@ -46,25 +46,16 @@ public:
// Can be called on any thread.
virtual void NotifyDecodedFrames(const FrameStatisticsData& aStats) = 0;
virtual AbstractCanonical<media::NullableTimeUnit>* CanonicalDurationOrNull()
{
return nullptr;
};
- // Return an event that will be notified when data arrives in MediaResource.
- // MediaDecoderReader will register with this event to receive notifications
- // in order to update buffer ranges.
- // Return null if this decoder doesn't support the event.
- virtual MediaEventSource<void>* DataArrivedEvent()
- {
- return nullptr;
- }
-
// Returns an event that will be notified when the owning document changes state
// and we might have a new compositor. If this new compositor requires us to
// recreate our decoders, then we expect the existing decoderis to return an
// error independently of this.
virtual MediaEventSource<RefPtr<layers::KnowsCompositor>>*
CompositorUpdatedEvent()
{
return nullptr;
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -534,19 +534,16 @@ private:
nsCString GetDebugInfo();
// Called when the metadata from the media file has been loaded by the
// state machine. Call on the main thread only.
void MetadataLoaded(UniquePtr<MediaInfo> aInfo,
UniquePtr<MetadataTags> aTags,
MediaDecoderEventVisibility aEventVisibility);
- MediaEventSource<void>*
- DataArrivedEvent() override { return &mDataArrivedEvent; }
-
// Called when the owner's activity changed.
void NotifyCompositor();
MediaEventSource<RefPtr<layers::KnowsCompositor>>*
CompositorUpdatedEvent() override { return &mCompositorUpdatedEvent; }
void OnPlaybackEvent(MediaEventType aEvent);
void OnPlaybackErrorEvent(const MediaResult& aError);
@@ -558,17 +555,16 @@ private:
mMediaSeekable = false;
}
void FinishShutdown();
void ConnectMirrors(MediaDecoderStateMachine* aObject);
void DisconnectMirrors();
- MediaEventProducer<void> mDataArrivedEvent;
MediaEventProducer<RefPtr<layers::KnowsCompositor>> mCompositorUpdatedEvent;
// The state machine object for handling the decoding. It is safe to
// call methods of this object from other threads. Its internal data
// is synchronised on a monitor. The lifetime of this object is
// after mPlayState is LOADING and before mPlayState is SHUTDOWN. It
// is safe to access it during this period.
//
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -86,20 +86,16 @@ MediaDecoderReader::MediaDecoderReader(A
{
MOZ_COUNT_CTOR(MediaDecoderReader);
MOZ_ASSERT(NS_IsMainThread());
}
nsresult
MediaDecoderReader::Init()
{
- if (mDecoder && mDecoder->DataArrivedEvent()) {
- mDataArrivedListener = mDecoder->DataArrivedEvent()->Connect(
- mTaskQueue, this, &MediaDecoderReader::NotifyDataArrived);
- }
// Dispatch initialization that needs to happen on that task queue.
mTaskQueue->Dispatch(
NewRunnableMethod("MediaDecoderReader::InitializationTask",
this,
&MediaDecoderReader::InitializationTask));
return InitInternal();
}
@@ -370,18 +366,16 @@ RefPtr<ShutdownPromise>
MediaDecoderReader::Shutdown()
{
MOZ_ASSERT(OnTaskQueue());
mShutdown = true;
mBaseAudioPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
mBaseVideoPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
- mDataArrivedListener.DisconnectIfExists();
-
ReleaseResources();
mDuration.DisconnectIfConnected();
mBuffered.DisconnectAll();
// Shut down the watch manager before shutting down our task queue.
mWatchManager.Shutdown();
mDecoder = nullptr;
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -373,15 +373,13 @@ private:
// The primary advantage of this implementation in the reader base class is
// that it's a fast approximation, which does not perform any I/O.
media::TimeIntervals GetBuffered();
// Promises used only for the base-class (sync->async adapter) implementation
// of Request{Audio,Video}Data.
MozPromiseHolder<AudioDataPromise> mBaseAudioPromise;
MozPromiseHolder<VideoDataPromise> mBaseVideoPromise;
-
- MediaEventListener mDataArrivedListener;
};
} // namespace mozilla
#endif