Use AVContentKeySession for "com.apple.fps.2_0" CDM version when AVStreamSession...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Mar 2019 18:30:11 +0000 (18:30 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Mar 2019 18:30:11 +0000 (18:30 +0000)
commitfe21e06a40fc49ccb9e329534c843e4a83386cdd
tree902b064598fb2d83870933c6a7494779ce981b74
parent35731aa214e871c717d5051ff83a6082fc6028bd
Use AVContentKeySession for "com.apple.fps.2_0" CDM version when AVStreamSession is absent
https://bugs.webkit.org/show_bug.cgi?id=195462
<rdar://problem/48712306>

Reviewed by Eric Carlson.

The difference between "com.apple.fps.2_0" and "3_0" is a protocol difference more than an
implementation difference. In "2_0", the "EME nitialization" data comes in the form of a "content
identifier", while the true initialization data is retrieved through a side channel directly from
the attached element. In "3_0", the "EME initialization data" is the exact initialization data
given by the parser, with no "content identifier" at all.

In the original implementation, the "2_0" used AVStreamSession, and "3_0" used AVContentKeySession,
but in the absense of AVStreamSession, those protocol differences are minor and can be implemented
using AVContentKeySession.

Changes:

- Add a new helper struct in CDMPrivateMediaSourceAVFObjC that represents the parsed parameters
  of the CDM string.
- Add an "initData()" accessor to SourceBufferPrivateAVFObjC so that the "2_0" path can implement
  the side channel access to the necessary initialization data.
- Refactor some of the SPI code to not re-declare unnecessary APIs.
- In CDMSessionAVContentKeySession::generateKeyRequest(), this function can never be called twice
  so it is a logical impossibility to have a certificate at this point. Remove all this if() code.

* Modules/encryptedmedia/legacy/LegacyCDM.cpp:
* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
(WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):
(WebCore::queryDecoderAvailability):
(WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem):
(WebCore::CDMPrivateMediaSourceAVFObjC::createSession):
(WebCore::validKeySystemRE): Deleted.
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::CDMSessionAVContentKeySession):
(WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
(WebCore::CDMSessionAVContentKeySession::update):
(WebCore::CDMSessionAVContentKeySession::addParser):
(WebCore::CDMSessionAVContentKeySession::removeParser):
(WebCore::CDMSessionAVContentKeySession::contentKeySession):
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::CDMSessionAVStreamSession):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.cpp
Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm