Skip to content
Permalink
Browse files
[EME] Make CDMInstance& parameter passed through MediaPlayer non-const
https://bugs.webkit.org/show_bug.cgi?id=180484

Reviewed by Jon Lee.

One can only call const methods on const references, and the obvious intent
of these methods is for the callee to call non-const methods on the parameters.

* Modules/encryptedmedia/MediaKeys.h:
(WebCore::MediaKeys::cdmInstance):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::cdmInstanceAttached):
(WebCore::MediaPlayer::cdmInstanceDetached):
(WebCore::MediaPlayer::attemptToDecryptWithInstance):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
(WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
(WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
(WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
(WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:


Canonical link: https://commits.webkit.org/196420@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Dec 6, 2017
1 parent 0862709 commit cef99063d869d2c65dcb79ad8cd25406de014528
Showing 9 changed files with 48 additions and 17 deletions.
@@ -1,3 +1,33 @@
2017-12-06 Jer Noble <jer.noble@apple.com>

[EME] Make CDMInstance& parameter passed through MediaPlayer non-const
https://bugs.webkit.org/show_bug.cgi?id=180484

Reviewed by Jon Lee.

One can only call const methods on const references, and the obvious intent
of these methods is for the callee to call non-const methods on the parameters.

* Modules/encryptedmedia/MediaKeys.h:
(WebCore::MediaKeys::cdmInstance):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::cdmInstanceAttached):
(WebCore::MediaPlayer::cdmInstanceDetached):
(WebCore::MediaPlayer::attemptToDecryptWithInstance):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
(WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
(WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
(WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
(WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:

2017-12-06 Youenn Fablet <youenn@apple.com>

Preflight should bypass service worker
@@ -65,6 +65,7 @@ class MediaKeys : public RefCounted<MediaKeys> {
void attemptToResumePlaybackOnClients();

bool hasOpenSessions() const;
CDMInstance& cdmInstance() { return m_instance; }
const CDMInstance& cdmInstance() const { return m_instance; }

protected:
@@ -600,17 +600,17 @@ void MediaPlayer::keyAdded()
#endif

#if ENABLE(ENCRYPTED_MEDIA)
void MediaPlayer::cdmInstanceAttached(const CDMInstance& instance)
void MediaPlayer::cdmInstanceAttached(CDMInstance& instance)
{
m_private->cdmInstanceAttached(instance);
}

void MediaPlayer::cdmInstanceDetached(const CDMInstance& instance)
void MediaPlayer::cdmInstanceDetached(CDMInstance& instance)
{
m_private->cdmInstanceDetached(instance);
}

void MediaPlayer::attemptToDecryptWithInstance(const CDMInstance& instance)
void MediaPlayer::attemptToDecryptWithInstance(CDMInstance& instance)
{
m_private->attemptToDecryptWithInstance(instance);
}
@@ -394,9 +394,9 @@ class MediaPlayer : public MediaPlayerEnums, public RefCounted<MediaPlayer> {
#endif

#if ENABLE(ENCRYPTED_MEDIA)
void cdmInstanceAttached(const CDMInstance&);
void cdmInstanceDetached(const CDMInstance&);
void attemptToDecryptWithInstance(const CDMInstance&);
void cdmInstanceAttached(CDMInstance&);
void cdmInstanceDetached(CDMInstance&);
void attemptToDecryptWithInstance(CDMInstance&);
#endif

bool paused() const;
@@ -237,9 +237,9 @@ class MediaPlayerPrivateInterface {
#endif

#if ENABLE(ENCRYPTED_MEDIA)
virtual void cdmInstanceAttached(const CDMInstance&) { }
virtual void cdmInstanceDetached(const CDMInstance&) { }
virtual void attemptToDecryptWithInstance(const CDMInstance&) { }
virtual void cdmInstanceAttached(CDMInstance&) { }
virtual void cdmInstanceDetached(CDMInstance&) { }
virtual void attemptToDecryptWithInstance(CDMInstance&) { }
#endif

#if ENABLE(VIDEO_TRACK)
@@ -1142,15 +1142,15 @@ unsigned MediaPlayerPrivateGStreamerBase::videoDecodedByteCount() const
}

#if ENABLE(ENCRYPTED_MEDIA)
void MediaPlayerPrivateGStreamerBase::cdmInstanceAttached(const CDMInstance& instance)
void MediaPlayerPrivateGStreamerBase::cdmInstanceAttached(CDMInstance& instance)
{
ASSERT(!m_cdmInstance);
m_cdmInstance = &instance;
GST_DEBUG("CDM instance %p set", m_cdmInstance.get());
m_protectionCondition.notifyAll();
}

void MediaPlayerPrivateGStreamerBase::cdmInstanceDetached(const CDMInstance& instance)
void MediaPlayerPrivateGStreamerBase::cdmInstanceDetached(CDMInstance& instance)
{
#ifdef NDEBUG
UNUSED_PARAM(instance);
@@ -1161,7 +1161,7 @@ void MediaPlayerPrivateGStreamerBase::cdmInstanceDetached(const CDMInstance& ins
m_protectionCondition.notifyAll();
}

void MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance(const CDMInstance& instance)
void MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance(CDMInstance& instance)
{
ASSERT(m_cdmInstance.get() == &instance);
GST_TRACE("instance %p, current stored %p", &instance, m_cdmInstance.get());
@@ -137,12 +137,12 @@ class MediaPlayerPrivateGStreamerBase : public MediaPlayerPrivateInterface
#endif

#if ENABLE(ENCRYPTED_MEDIA)
void cdmInstanceAttached(const CDMInstance&) override;
void cdmInstanceDetached(const CDMInstance&) override;
void cdmInstanceAttached(CDMInstance&) override;
void cdmInstanceDetached(CDMInstance&) override;
void dispatchDecryptionKey(GstBuffer*);
void handleProtectionEvent(GstEvent*);
void attemptToDecryptWithLocalInstance();
void attemptToDecryptWithInstance(const CDMInstance&) override;
void attemptToDecryptWithInstance(CDMInstance&) override;
#endif

static bool supportsKeySystem(const String& keySystem, const String& mimeType);
@@ -936,7 +936,7 @@ MediaTime MediaPlayerPrivateGStreamerMSE::maxMediaTimeSeekable() const
}

#if ENABLE(ENCRYPTED_MEDIA)
void MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance(const CDMInstance& instance)
void MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance(CDMInstance& instance)
{
if (is<CDMInstanceClearKey>(instance)) {
auto& ckInstance = downcast<CDMInstanceClearKey>(instance);
@@ -87,7 +87,7 @@ class MediaPlayerPrivateGStreamerMSE : public MediaPlayerPrivateGStreamer {
static bool supportsAllCodecs(const Vector<String>& codecs);

#if ENABLE(ENCRYPTED_MEDIA)
void attemptToDecryptWithInstance(const CDMInstance&) final;
void attemptToDecryptWithInstance(CDMInstance&) final;
#endif

private:

0 comments on commit cef9906

Please sign in to comment.