Bug 1394316 - provide default implementation to MediaDecoderOwner methods that involve Gecko specific types.
MozReview-Commit-ID: 7hhJgeYH7ys
--- a/dom/media/MediaDecoderOwner.h
+++ b/dom/media/MediaDecoderOwner.h
@@ -36,26 +36,16 @@ public:
/**
* Fires a timeupdate event. If aPeriodic is true, the event will only
* be fired if we've not fired a timeupdate event (for any reason) in the
* last 250ms, as required by the spec when the current time is periodically
* increasing during playback.
*/
virtual void FireTimeUpdate(bool aPeriodic) = 0;
- // Get the HTMLMediaElement object if the decoder is being used from an
- // HTML media element, and null otherwise.
- virtual dom::HTMLMediaElement* GetMediaElement()
- {
- return nullptr;
- }
-
- // Return an abstract thread on which to run main thread runnables.
- virtual AbstractThread* AbstractMainThread() const = 0;
-
// Return true if decoding should be paused
virtual bool GetPaused() = 0;
// Called by the video decoder object, on the main thread,
// when it has read the metadata containing video dimensions,
// etc.
// Must take ownership of MetadataTags aTags argument.
virtual void MetadataLoaded(const MediaInfo* aInfo,
@@ -138,55 +128,74 @@ public:
};
// Check if the decoder owner is active.
virtual bool IsActive() const = 0;
// Check if the decoder owner is hidden.
virtual bool IsHidden() const = 0;
- // Called by the media decoder and the video frame to get the
- // ImageContainer containing the video data.
- virtual VideoFrameContainer* GetVideoFrameContainer() = 0;
-
// Called by media decoder when the audible state changed
virtual void SetAudibleState(bool aAudible) = 0;
// Notified by the decoder that XPCOM shutdown has begun.
// The decoder owner should call Shutdown() on the decoder and drop the
// reference to the decoder to prevent further calls into the decoder.
virtual void NotifyXPCOMShutdown() = 0;
// Dispatches a "encrypted" event to the HTMLMediaElement, with the
// provided init data. Actual dispatch may be delayed until HAVE_METADATA.
// Main thread only.
virtual void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) = 0;
- // Return the decoder owner's owner document.
- virtual nsIDocument* GetDocument() const = 0;
-
// Called by the media decoder to create audio/video tracks and add to its
// owner's track list.
virtual void ConstructMediaTracks(const MediaInfo* aInfo) = 0;
// Called by the media decoder to removes all audio/video tracks from its
// owner's track list.
virtual void RemoveMediaTracks() = 0;
- // Called by the media decoder to create a GMPCrashHelper.
- virtual already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper() = 0;
-
// Called by the media decoder to notify the owner to resolve a seek promise.
virtual void AsyncResolveSeekDOMPromiseIfExists() = 0;
// Called by the media decoder to notify the owner to reject a seek promise.
virtual void AsyncRejectSeekDOMPromiseIfExists() = 0;
// Notified by the decoder that a decryption key is required before emitting
// further output.
virtual void NotifyWaitingForKey() {}
+
+ /*
+ * Methods that are used only in Gecko go here. We provide defaul
+ * implementations so they can compile in Servo without modification.
+ */
+ // Return an abstract thread on which to run main thread runnables.
+ virtual AbstractThread* AbstractMainThread() const { return nullptr; }
+
+ // Get the HTMLMediaElement object if the decoder is being used from an
+ // HTML media element, and null otherwise.
+ virtual dom::HTMLMediaElement* GetMediaElement() { return nullptr; }
+
+ // Called by the media decoder and the video frame to get the
+ // ImageContainer containing the video data.
+ virtual VideoFrameContainer* GetVideoFrameContainer() { return nullptr; }
+
+ // Return the decoder owner's owner document.
+ virtual nsIDocument* GetDocument() const { return nullptr; }
+
+ // Called by the media decoder to create a GMPCrashHelper.
+ virtual already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper()
+ {
+ return nullptr;
+ }
+
+ /*
+ * Servo only methods go here. Please provide default implementations so they
+ * can build in Gecko without any modification.
+ */
};
} // namespace mozilla
#endif
--- a/dom/media/gtest/MockMediaDecoderOwner.h
+++ b/dom/media/gtest/MockMediaDecoderOwner.h
@@ -37,29 +37,23 @@ public:
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) override {}
bool IsActive() const override { return true; }
bool IsHidden() const override { return false; }
void DownloadSuspended() override {}
void DownloadResumed(bool aForceNetworkLoading) override {}
void NotifySuspendedByCache(bool aIsSuspended) override {}
void NotifyDecoderPrincipalChanged() override {}
- VideoFrameContainer* GetVideoFrameContainer() override
- {
- return nullptr;
- }
void SetAudibleState(bool aAudible) override {}
void NotifyXPCOMShutdown() override {}
AbstractThread* AbstractMainThread() const override
{
// Non-DocGroup version for Mock.
return AbstractThread::MainThread();
}
- nsIDocument* GetDocument() const { return nullptr; }
void ConstructMediaTracks(const MediaInfo* aInfo) {}
void RemoveMediaTracks() {}
- already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper() { return nullptr; }
void AsyncResolveSeekDOMPromiseIfExists() override {}
void AsyncRejectSeekDOMPromiseIfExists() override {}
};
}
#endif