Bug 1390748 - Make MediaDecoder::CreateStateMachine() non-virtual. r=jwwang
MediaDecoder::CreateStateMachine is only virtual so that Ogg can attach
the reader's metadata/seekable produces to its chaining event.
The MediaSourceDecoder also overrides CreateStateMachine(), but it's not
called by anything external, so its implementation doesn't actually need
to be virtual.
MozReview-Commit-ID: 2x6bpK6Fdzd
--- a/dom/media/ChannelMediaDecoder.h
+++ b/dom/media/ChannelMediaDecoder.h
@@ -62,18 +62,16 @@ protected:
MediaDecoderEventVisibility aEventVisibility) override;
RefPtr<ResourceCallback> mResourceCallback;
RefPtr<BaseMediaResource> mResource;
public:
explicit ChannelMediaDecoder(MediaDecoderInit& aInit);
- MediaDecoderStateMachine* CreateStateMachine() override;
-
MediaResource* GetResource() const override final;
void Shutdown() override;
bool CanClone();
// Create a new decoder of the same type as this one.
already_AddRefed<ChannelMediaDecoder> Clone(MediaDecoderInit& aInit);
@@ -82,16 +80,19 @@ public:
bool aIsPrivateBrowsing,
nsIStreamListener** aStreamListener);
void SetLoadInBackground(bool aLoadInBackground) override;
void Suspend() override;
void Resume() override;
private:
+ // Create a new state machine to run this decoder.
+ MediaDecoderStateMachine* CreateStateMachine();
+
virtual ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) = 0;
nsresult OpenResource(nsIStreamListener** aStreamListener);
nsresult Load(BaseMediaResource* aOriginal);
// Called by MediaResource when the download has ended.
// Called on the main thread only. aStatus is the result from OnStopRequest.
void NotifyDownloadEnded(nsresult aStatus);
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -103,20 +103,16 @@ public:
static void InitStatics();
explicit MediaDecoder(MediaDecoderInit& aInit);
// Returns the container content type of the resource.
// Safe to call from any thread.
const MediaContainerType& ContainerType() const { return mContainerType; }
- // Create a new state machine to run this decoder.
- // Subclasses must implement this.
- virtual MediaDecoderStateMachine* CreateStateMachine() = 0;
-
// Cleanup internal data structures. Must be called on the main
// thread by the owning object before that object disposes of this object.
virtual void Shutdown();
// Notified by the shutdown manager that XPCOM shutdown has begun.
// The decoder should notify its owner to drop the reference to the decoder
// to prevent further calls into the decoder.
void NotifyXPCOMShutdown();
--- a/dom/media/mediasource/MediaSourceDecoder.h
+++ b/dom/media/mediasource/MediaSourceDecoder.h
@@ -24,17 +24,16 @@ class MediaSource;
class MediaSourceDecoder : public MediaDecoder
{
public:
explicit MediaSourceDecoder(MediaDecoderInit& aInit);
MediaResource* GetResource() const override final;
- MediaDecoderStateMachine* CreateStateMachine() override;
nsresult Load(nsIPrincipal* aPrincipal);
media::TimeIntervals GetSeekable() override;
media::TimeIntervals GetBuffered() override;
void Shutdown() override;
void AttachMediaSource(dom::MediaSource* aMediaSource);
void DetachMediaSource();
@@ -60,16 +59,17 @@ public:
MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus() override;
bool IsMSE() const override { return true; }
void NotifyInitDataArrived();
private:
+ MediaDecoderStateMachine* CreateStateMachine();
void DoSetMediaSourceDuration(double aDuration);
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
bool CanPlayThroughImpl() override;
RefPtr<MediaSourceResource> mResource;
// The owning MediaSource holds a strong reference to this decoder, and
// calls Attach/DetachMediaSource on this decoder to set and clear