RESOLVED FIXED 201339
[EME] Introduce a Proxy CDM for thread-safe access to CDM instances from background decryption threads
https://bugs.webkit.org/show_bug.cgi?id=201339
Summary [EME] Introduce a Proxy CDM for thread-safe access to CDM instances from back...
Charlie Turner
Reported 2019-08-30 05:20:01 PDT
[EME] Introduce a Proxy CDM for thread-safe access to CDM instances from background decryption threads
Attachments
Patch (16.98 KB, patch)
2019-08-30 05:20 PDT, Charlie Turner
no flags
Patch (19.89 KB, patch)
2019-09-04 11:04 PDT, Charlie Turner
no flags
Patch (19.90 KB, patch)
2019-09-05 01:08 PDT, Charlie Turner
no flags
Patch (19.34 KB, patch)
2019-09-05 10:56 PDT, Charlie Turner
no flags
Patch for landing (19.34 KB, patch)
2019-09-05 14:42 PDT, Charlie Turner
no flags
Patch for landing (19.34 KB, patch)
2019-09-05 14:43 PDT, Charlie Turner
no flags
Charlie Turner
Comment 1 2019-08-30 05:20:50 PDT
Created attachment 377700 [details] Patch This won't build on Mac ports because I haven't modifieded the CDM instance there. Review on the approach is appreciated, the ClearKey proxy CDM in the future should contain all the GCrypt code in my opinion, right now it wastes a lot of copies shoving all the keys into the background decryptor threads
Charlie Turner
Comment 2 2019-08-30 05:32:40 PDT
CC Jer, this is a spin-off from https://bugs.webkit.org/show_bug.cgi?id=192229#c25 Again it might seem quite pointless, but such a ProxyCDM will be used more heavily with Widevine / Playready. It also seems like a good idea to move the GCrypt code from our GStreamer-specific decryptor into the cross-platform ClearKey CDM. The patch is not for landing as it, the comments need tidying, and the approached needs to be blessed.
Xabier Rodríguez Calvar
Comment 3 2019-09-02 08:29:09 PDT
Comment on attachment 377700 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377700&action=review LGTM as a WIP patch. > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1323 > + GST_DEBUG_OBJECT(m_pipeline.get(), "CDM proxy instance %p dispatched as context", m_cdmInstance->proxyCDM().get()); I'd say ProxyCDM instance... > Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:298 > + GST_DEBUG_OBJECT(self, "received a new CDM proxy instance %p, refcount %u", priv->proxyCDM.get(), priv->proxyCDM->refCount()); ProxyCDM
Charlie Turner
Comment 4 2019-09-04 11:04:51 PDT
Created attachment 377988 [details] Patch Attempt #1 to get the build green for Mac ports.
Charlie Turner
Comment 5 2019-09-05 00:42:34 PDT
I don't understand the iOS build failures, In file included from /Volumes/Data/worker/iOS-12-Build-EWS/build/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:30: /Volumes/Data/worker/iOS-12-Build-EWS/build/Source/WebCore/platform/encryptedmedia/CDMInstance.h:80:30: note: unimplemented pure virtual method 'proxyCDM' in 'CDMInstanceFairPlayStreamingAVFObjC' virtual RefPtr<ProxyCDM> proxyCDM() const = 0; That method is implemented in CDMInstanceFairPlayStreamingAVFObjC, + RefPtr<ProxyCDM> proxyCDM() final { return adoptRef(*new ProxyCDMFairPlayStreamingAVFObjC()); } And builds on Mac ports.
Charlie Turner
Comment 6 2019-09-05 01:08:41 PDT
Created attachment 378056 [details] Patch Sneaky method signature diff, Mac port attempt #2
Xabier Rodríguez Calvar
Comment 7 2019-09-05 03:04:36 PDT
Comment on attachment 378056 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=378056&action=review LGTM, Jer, Eric, any objections? > Source/WebCore/platform/encryptedmedia/CDMInstance.h:47 > +// from background threads (I.e. decryptors) .
Jer Noble
Comment 8 2019-09-05 09:44:53 PDT
Comment on attachment 378056 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=378056&action=review > Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:52 > +class ProxyCDMFairPlayStreamingAVFObjC final : public ProxyCDM { > + virtual ~ProxyCDMFairPlayStreamingAVFObjC() = default; > +}; > + This... > Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:70 > + RefPtr<ProxyCDM> proxyCDM() const final { return adoptRef(*new ProxyCDMFairPlayStreamingAVFObjC()); } ...and this seem unnecessary. Can this just return null?
Charlie Turner
Comment 9 2019-09-05 10:56:21 PDT
Created attachment 378096 [details] Patch Do not provide scaffolding for ProxyCDM on Mac ports
Jer Noble
Comment 10 2019-09-05 11:31:10 PDT
(In reply to Charlie Turner from comment #9) > Created attachment 378096 [details] > Patch > > Do not provide scaffolding for ProxyCDM on Mac ports LGTM
Charlie Turner
Comment 11 2019-09-05 14:42:52 PDT
Created attachment 378124 [details] Patch for landing
Charlie Turner
Comment 12 2019-09-05 14:43:21 PDT
Created attachment 378125 [details] Patch for landing
WebKit Commit Bot
Comment 13 2019-09-05 14:59:04 PDT
Comment on attachment 378125 [details] Patch for landing Clearing flags on attachment: 378125 Committed r249548: <https://trac.webkit.org/changeset/249548>
WebKit Commit Bot
Comment 14 2019-09-05 14:59:05 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 15 2019-09-05 15:00:19 PDT
Note You need to log in before you can comment on or make changes to this bug.