<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[178446] branches/safari-600.5-branch/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/178446">178446</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2015-01-14 14:20:48 -0800 (Wed, 14 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/173197">r173197</a>. <rdar://problem/19424142></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6005branchSourceWebCoreChangeLog">branches/safari-600.5-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreModulesencryptedmediaCDMcpp">branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/CDM.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreModulesencryptedmediaMediaKeySessionh">branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreModulesencryptedmediaMediaKeyscpp">branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreWebCorexcodeprojprojectpbxproj">branches/safari-600.5-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsCDMSessionh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/CDMSession.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsMediaPlayercpp">branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsMediaPlayerh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsMediaPlayerPrivateh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVFoundationObjCh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCmm">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaSourceAVFObjCh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaSourceAVFObjCmm">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaSourcePrivateAVFObjCh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaSourcePrivateAVFObjCmm">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationCDMPrivateMediaSourceAVFObjCh">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h</a></li>
<li><a href="#branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationCDMPrivateMediaSourceAVFObjCmm">branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6005branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/ChangeLog (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/ChangeLog        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/ChangeLog        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -1,5 +1,76 @@
</span><span class="cx"> 2015-01-14 Dana Burkart <dburkart@apple.com>
</span><span class="cx">
</span><ins>+ Merged r173197. <rdar://problem/19424142>
+
+ 2014-09-02 Jer Noble <jer.noble@apple.com>
+
+ [EME][Mac] Refactor CDMPrivateMediaSourceAVFObjC to allow sessions to be created without being attached to an AVStreamDataParser.
+ https://bugs.webkit.org/show_bug.cgi?id=136016
+
+ Reviewed by Eric Carlson.
+
+ The CDMPrivateMediaPlayer class will delegate creation of CDMSession instances to the current MediaPlayer. This
+ of course requires the MediaKeys object owning the CDM to be attached to a HTMLMediaElement, and specifically to
+ one with a valid src attribute or source node which has sucessfully begun loading. For certain CDM operations,
+ it would be better if a given MediaKeys could create a session without actually being connected to a
+ HTMLMediaElement (yet).
+
+ To facilitate this for CDMSessionPrivateMediaSourceAVFObjC, add a new class, CDMPrivateMediaSourceAVFObjC, which
+ is the primary factory for CDMSessionPrivateMediaSOurceAVFObjC. Disclaim responsibility for creating these sessions
+ in MediaPlayerPrivateMediaSourceAVFObjC by not passing the "supportsKeySystem" method when registering itself.
+
+ Add methods to CDMSessionPrivateMediaSourceAVFObjC to allow SourceBuffers to be added and removed from the session,
+ to support adding the session to the HTMLMediaElement after the session has been created.
+
+ Since MediaPlayerPrivate instance and CDMSession instances must be able to communicate with one another, add a type()
+ enum and virtual method to allow CDMSession instnaces to be distinguisted from (and casted to) one another.
+
+ * Modules/encryptedmedia/CDM.cpp:
+ (WebCore::installedCDMFactories): Register CDMPrivateMediaSourceAVFObjC.
+ (WebCore::CDM::createSession): Notify the MediaPlayer of the new CDMSession.
+ * Modules/encryptedmedia/MediaKeySession.h:
+ * Modules/encryptedmedia/MediaKeys.cpp:
+ (WebCore::MediaKeys::setMediaElement): Notify the HTMLMediaElement of any existing sessions.
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/CDMSession.h:
+ (WebCore::CDMSession::type): Added.
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::setCDMSession): Pass through to the MediaPlayerPrivate.
+ * platform/graphics/MediaPlayer.h:
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::setCDMSession): Added. Default no-op.
+ * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h: Added.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::CDMPrivateMediaSourceAVFObjC): Simple constructor.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::~CDMPrivateMediaSourceAVFObjC): Simple destructor.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::create): Simple factory.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::cdm): Simple accessor.
+ * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
+ (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem): Moved from MediaPlayerPrivateMediaSourceAVFObjC.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType): Ditto.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType): Ditto.
+ (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Returns new CDMSessionMediaSourceAVFObjC.
+ * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
+ (WebCore::CDMSessionAVFoundationObjC::type): Added.
+ * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
+ (WebCore::CDMSessionMediaSourceAVFObjC::type): Added.
+ (WebCore::toCDMSessionMediaSourceAVFObjC): Throw assertion if type() is not correct.
+ * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+ (WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC): Removed m_parent ivar.
+ (WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC): Ditto.
+ (WebCore::CDMSessionMediaSourceAVFObjC::update): Determing which SourceBuffer is protected.
+ (WebCore::CDMSessionMediaSourceAVFObjC::addSourceBuffer): Added.
+ (WebCore::CDMSessionMediaSourceAVFObjC::removeSourceBuffer): Added.
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): Remove supportsKeyType parameter.
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): Remove keyType check.
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession): Tell the CDMSession about outstanding SourceBuffers.
+ * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
+
+2015-01-14 Dana Burkart <dburkart@apple.com>
+
</ins><span class="cx"> Merged r172651. <rdar://problem/19424141>
</span><span class="cx">
</span><span class="cx"> 2014-08-15 Jer Noble <jer.noble@apple.com>
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreModulesencryptedmediaCDMcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/CDM.cpp (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/CDM.cpp        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/CDM.cpp        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -33,9 +33,14 @@
</span><span class="cx"> #include "CDMSession.h"
</span><span class="cx"> #include "MediaKeyError.h"
</span><span class="cx"> #include "MediaKeys.h"
</span><ins>+#include "MediaPlayer.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE)
+#include "CDMPrivateMediaSourceAVFObjC.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> struct CDMFactory {
</span><span class="lines">@@ -62,6 +67,10 @@
</span><span class="cx">
</span><span class="cx"> // FIXME: initialize specific UA CDMs. http://webkit.org/b/109318, http://webkit.org/b/109320
</span><span class="cx"> cdms.get().append(new CDMFactory(CDMPrivateMediaPlayer::create, CDMPrivateMediaPlayer::supportsKeySystem, CDMPrivateMediaPlayer::supportsKeySystemAndMimeType));
</span><ins>+
+#if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE)
+ cdms.get().append(new CDMFactory(CDMPrivateMediaSourceAVFObjC::create, CDMPrivateMediaSourceAVFObjC::supportsKeySystem, CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType));
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return cdms;
</span><span class="lines">@@ -120,7 +129,10 @@
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<CDMSession> CDM::createSession()
</span><span class="cx"> {
</span><del>- return m_private->createSession();
</del><ins>+ std::unique_ptr<CDMSession> session = m_private->createSession();
+ if (mediaPlayer())
+ mediaPlayer()->setCDMSession(session.get());
+ return session;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MediaPlayer* CDM::mediaPlayer() const
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreModulesencryptedmediaMediaKeySessionh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> ~MediaKeySession();
</span><span class="cx">
</span><span class="cx"> const String& keySystem() const { return m_keySystem; }
</span><ins>+ CDMSession* session() { return m_session.get(); }
</ins><span class="cx"> const String& sessionId() const;
</span><span class="cx">
</span><span class="cx"> void setError(MediaKeyError*);
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreModulesencryptedmediaMediaKeyscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -144,7 +144,13 @@
</span><span class="cx">
</span><span class="cx"> void MediaKeys::setMediaElement(HTMLMediaElement* element)
</span><span class="cx"> {
</span><ins>+ if (m_mediaElement)
+ m_mediaElement->player()->setCDMSession(nullptr);
+
</ins><span class="cx"> m_mediaElement = element;
</span><ins>+
+ if (m_mediaElement && !m_sessions.isEmpty())
+ m_mediaElement->player()->setCDMSession(m_sessions.last()->session());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MediaPlayer* MediaKeys::cdmMediaPlayer(const CDM*) const
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -5644,6 +5644,8 @@
</span><span class="cx">                 CD2F4A2418D89F700063746D /* AudioHardwareListener.h in Headers */ = {isa = PBXBuildFile; fileRef = CD2F4A2218D89F700063746D /* AudioHardwareListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CD2F4A2718D8A3490063746D /* AudioHardwareListenerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD2F4A2518D8A3490063746D /* AudioHardwareListenerMac.cpp */; };
</span><span class="cx">                 CD2F4A2818D8A3490063746D /* AudioHardwareListenerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = CD2F4A2618D8A3490063746D /* AudioHardwareListenerMac.h */; };
</span><ins>+                CD318622199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD318620199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm */; };
+                CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CD318621199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h */; };
</ins><span class="cx">                 CD336F6117F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD336F5F17F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm */; };
</span><span class="cx">                 CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD336F6017F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h */; };
</span><span class="cx">                 CD336F6417FA0A4D00DDDCD0 /* VideoTrackPrivateAVF.h in Headers */ = {isa = PBXBuildFile; fileRef = CD336F6317FA0A4D00DDDCD0 /* VideoTrackPrivateAVF.h */; };
</span><span class="lines">@@ -13105,6 +13107,8 @@
</span><span class="cx">                 CD2F4A2218D89F700063746D /* AudioHardwareListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioHardwareListener.h; sourceTree = "<group>"; };
</span><span class="cx">                 CD2F4A2518D8A3490063746D /* AudioHardwareListenerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioHardwareListenerMac.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 CD2F4A2618D8A3490063746D /* AudioHardwareListenerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioHardwareListenerMac.h; sourceTree = "<group>"; };
</span><ins>+                CD318620199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CDMPrivateMediaSourceAVFObjC.mm; sourceTree = "<group>"; };
+                CD318621199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDMPrivateMediaSourceAVFObjC.h; sourceTree = "<group>"; };
</ins><span class="cx">                 CD32A189184EB46A0029B1BB /* mediaControlsiOS.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = mediaControlsiOS.js; sourceTree = "<group>"; };
</span><span class="cx">                 CD336F5F17F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVTrackPrivateAVFObjCImpl.mm; sourceTree = "<group>"; };
</span><span class="cx">                 CD336F6017F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVTrackPrivateAVFObjCImpl.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -21754,6 +21758,8 @@
</span><span class="cx">                                 CD54A761180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.h */,
</span><span class="cx">                                 CD336F6017F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h */,
</span><span class="cx">                                 CD336F5F17F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm */,
</span><ins>+                                CD318621199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h */,
+                                CD318620199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm */,
</ins><span class="cx">                                 CDDE02EA18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.h */,
</span><span class="cx">                                 CDDE02EB18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.mm */,
</span><span class="cx">                                 CDDE02EE18B564FA00CF7FF1 /* CDMSessionMediaSourceAVFObjC.h */,
</span><span class="lines">@@ -24706,6 +24712,7 @@
</span><span class="cx">                                 B27535710B053814002CE64F /* ImageSource.h in Headers */,
</span><span class="cx">                                 4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */,
</span><span class="cx">                                 316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */,
</span><ins>+                                CD318623199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.h in Headers */,
</ins><span class="cx">                                 BE16C59317CFE17200852C04 /* InbandGenericTextTrack.h in Headers */,
</span><span class="cx">                                 07941792166E855F009416C2 /* InbandTextTrack.h in Headers */,
</span><span class="cx">                                 07941794166EA04E009416C2 /* InbandTextTrackPrivate.h in Headers */,
</span><span class="lines">@@ -27658,6 +27665,7 @@
</span><span class="cx">                                 85BA4CDE0AA6861B0088052D /* DOMHTMLButtonElement.mm in Sources */,
</span><span class="cx">                                 93F9B6570BA0F35E00854064 /* DOMHTMLCanvasElement.mm in Sources */,
</span><span class="cx">                                 85DF2F8F0AA3C88100AD64C5 /* DOMHTMLCollection.mm in Sources */,
</span><ins>+                                CD318622199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm in Sources */,
</ins><span class="cx">                                 F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */,
</span><span class="cx">                                 D359D792129CA3C00006E5D2 /* DOMHTMLDetailsElement.mm in Sources */,
</span><span class="cx">                                 85BA4D0C0AA688680088052D /* DOMHTMLDirectoryElement.mm in Sources */,
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsCDMSessionh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/CDMSession.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/CDMSession.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/CDMSession.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -52,11 +52,18 @@
</span><span class="cx"> virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) = 0;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+enum CDMSessionType {
+ CDMSessionTypeUnknown,
+ CDMSessionTypeAVFoundationObjC,
+ CDMSessionTypeMediaSourceAVFObjC,
+};
+
</ins><span class="cx"> class CDMSession {
</span><span class="cx"> public:
</span><span class="cx"> CDMSession() { }
</span><span class="cx"> virtual ~CDMSession() { }
</span><span class="cx">
</span><ins>+ virtual CDMSessionType type() { return CDMSessionTypeUnknown; }
</ins><span class="cx"> virtual void setClient(CDMSessionClient*) = 0;
</span><span class="cx"> virtual const String& sessionId() const = 0;
</span><span class="cx"> virtual PassRefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) = 0;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsMediaPlayercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -510,6 +510,11 @@
</span><span class="cx"> {
</span><span class="cx"> return m_private->createSession(keySystem);
</span><span class="cx"> }
</span><ins>+
+void MediaPlayer::setCDMSession(CDMSession* session)
+{
+ m_private->setCDMSession(session);
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> double MediaPlayer::duration() const
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsMediaPlayerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayer.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -359,6 +359,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><span class="cx"> std::unique_ptr<CDMSession> createSession(const String& keySystem);
</span><ins>+ void setCDMSession(CDMSession*);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> bool paused() const;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsMediaPlayerPrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -222,6 +222,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><span class="cx"> virtual std::unique_ptr<CDMSession> createSession(const String&) { return nullptr; }
</span><ins>+ virtual void setCDMSession(CDMSession*) { }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationCDMPrivateMediaSourceAVFObjChfromrev173197trunkSourceWebCoreplatformgraphicsavfoundationCDMPrivateMediaSourceAVFObjCh"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h (from rev 173197, trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h) (0 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h         (rev 0)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CDMPrivateMediaSourceAVFObjC_h
+#define CDMPrivateMediaSourceAVFObjC_h
+
+#if ENABLE(ENCRYPTED_MEDIA_V2) && ENABLE(MEDIA_SOURCE)
+
+#include "CDMPrivate.h"
+
+namespace WebCore {
+
+class CDM;
+
+class CDMPrivateMediaSourceAVFObjC : public CDMPrivateInterface {
+public:
+ explicit CDMPrivateMediaSourceAVFObjC(CDM* cdm)
+ : m_cdm(cdm)
+ { }
+ virtual ~CDMPrivateMediaSourceAVFObjC() { }
+
+ static std::unique_ptr<CDMPrivateInterface> create(CDM* cdm) { return std::make_unique<CDMPrivateMediaSourceAVFObjC>(cdm); }
+ static bool supportsKeySystem(const String&);
+ static bool supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType);
+
+ virtual bool supportsMIMEType(const String& mimeType) override;
+ virtual std::unique_ptr<CDMSession> createSession() override;
+
+ CDM* cdm() const { return m_cdm; }
+
+protected:
+ CDM* m_cdm;
+};
+
+}
+
+#endif // ENABLE(ENCRYPTED_MEDIA_V2) && ENABLE(MEDIA_SOURCE)
+
+#endif // CDMPrivateMediaSourceAVFObjC_h
</ins></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationCDMPrivateMediaSourceAVFObjCmmfromrev173197trunkSourceWebCoreplatformgraphicsavfoundationCDMPrivateMediaSourceAVFObjCmm"></a>
<div class="copfile"><h4>Copied: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm (from rev 173197, trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm) (0 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm         (rev 0)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "CDMPrivateMediaSourceAVFObjC.h"
+
+#if ENABLE(ENCRYPTED_MEDIA_V2) && ENABLE(MEDIA_SOURCE)
+
+#import "CDM.h"
+#import "CDMSessionMediaSourceAVFObjC.h"
+#import "ContentType.h"
+#import "ExceptionCode.h"
+#import "MediaPlayerPrivateMediaSourceAVFObjC.h"
+#import "WebCoreSystemInterface.h"
+
+namespace WebCore {
+
+bool CDMPrivateMediaSourceAVFObjC::supportsKeySystem(const String& keySystem)
+{
+ if (!wkQueryDecoderAvailability())
+ return false;
+
+ if (!keySystem.isEmpty() && !equalIgnoringCase(keySystem, "com.apple.fps.2_0"))
+ return false;
+
+ return true;
+}
+
+bool CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType)
+{
+ if (!supportsKeySystem(keySystem))
+ return false;
+
+ if (!mimeType.isEmpty()) {
+ MediaEngineSupportParameters parameters;
+ parameters.isMediaSource = true;
+ parameters.type = mimeType;
+
+ return MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) != MediaPlayer::IsNotSupported;
+ }
+
+ return true;
+}
+
+bool CDMPrivateMediaSourceAVFObjC::supportsMIMEType(const String& mimeType)
+{
+ MediaEngineSupportParameters parameters;
+ parameters.isMediaSource = true;
+ parameters.type = mimeType;
+
+ return MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) != MediaPlayer::IsNotSupported;
+}
+
+std::unique_ptr<CDMSession> CDMPrivateMediaSourceAVFObjC::createSession()
+{
+ return std::make_unique<CDMSessionMediaSourceAVFObjC>();
+}
+
+}
+
+#endif // ENABLE(ENCRYPTED_MEDIA_V2) && ENABLE(MEDIA_SOURCE)
</ins></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> CDMSessionAVFoundationObjC(MediaPlayerPrivateAVFoundationObjC* parent);
</span><span class="cx"> virtual ~CDMSessionAVFoundationObjC() { }
</span><span class="cx">
</span><ins>+ virtual CDMSessionType type() { return CDMSessionTypeAVFoundationObjC; }
</ins><span class="cx"> virtual void setClient(CDMSessionClient* client) override { m_client = client; }
</span><span class="cx"> virtual const String& sessionId() const override { return m_sessionId; }
</span><span class="cx"> virtual PassRefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) override;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -39,9 +39,10 @@
</span><span class="cx">
</span><span class="cx"> class CDMSessionMediaSourceAVFObjC : public CDMSession, public SourceBufferPrivateAVFObjCErrorClient {
</span><span class="cx"> public:
</span><del>- CDMSessionMediaSourceAVFObjC(SourceBufferPrivateAVFObjC* parent);
</del><ins>+ CDMSessionMediaSourceAVFObjC();
</ins><span class="cx"> virtual ~CDMSessionMediaSourceAVFObjC();
</span><span class="cx">
</span><ins>+ virtual CDMSessionType type() { return CDMSessionTypeMediaSourceAVFObjC; }
</ins><span class="cx"> virtual void setClient(CDMSessionClient* client) override { m_client = client; }
</span><span class="cx"> virtual const String& sessionId() const override { return m_sessionId; }
</span><span class="cx"> virtual PassRefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) override;
</span><span class="lines">@@ -51,8 +52,11 @@
</span><span class="cx"> virtual void layerDidReceiveError(AVSampleBufferDisplayLayer *, NSError *);
</span><span class="cx"> virtual void rendererDidReceiveError(AVSampleBufferAudioRenderer *, NSError *);
</span><span class="cx">
</span><ins>+ void addSourceBuffer(SourceBufferPrivateAVFObjC*);
+ void removeSourceBuffer(SourceBufferPrivateAVFObjC*);
+
</ins><span class="cx"> protected:
</span><del>- RefPtr<SourceBufferPrivateAVFObjC> m_parent;
</del><ins>+ Vector<RefPtr<SourceBufferPrivateAVFObjC>> m_sourceBuffers;
</ins><span class="cx"> CDMSessionClient* m_client;
</span><span class="cx"> RetainPtr<AVStreamSession> m_streamSession;
</span><span class="cx"> RefPtr<Uint8Array> m_initData;
</span><span class="lines">@@ -60,8 +64,15 @@
</span><span class="cx"> String m_sessionId;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+inline CDMSessionMediaSourceAVFObjC* toCDMSessionMediaSourceAVFObjC(CDMSession* session)
+{
+ if (!session || session->type() != CDMSessionTypeMediaSourceAVFObjC)
+ return nullptr;
+ return static_cast<CDMSessionMediaSourceAVFObjC*>(session);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #endif // CDMSessionMediaSourceAVFObjC_h
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcCDMSessionMediaSourceAVFObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -62,23 +62,19 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC(SourceBufferPrivateAVFObjC* parent)
- : m_parent(parent)
- , m_client(nullptr)
</del><ins>+CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC()
+ : m_client(nullptr)
</ins><span class="cx"> , m_sessionId(createCanonicalUUIDString())
</span><span class="cx"> {
</span><del>- ASSERT(parent);
- parent->registerForErrorNotifications(this);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC()
</span><span class="cx"> {
</span><span class="cx"> if (m_streamSession) {
</span><del>- [m_streamSession removeStreamDataParser:m_parent->parser()];
</del><ins>+ for (auto& sourceBuffer : m_sourceBuffers)
+ [m_streamSession removeStreamDataParser:sourceBuffer->parser()];
</ins><span class="cx"> m_streamSession = nil;
</span><span class="cx"> }
</span><del>- m_parent->unregisterForErrorNotifications(this);
- m_client = nullptr;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<Uint8Array> CDMSessionMediaSourceAVFObjC::generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode)
</span><span class="lines">@@ -134,18 +130,33 @@
</span><span class="cx"> m_certificate = key;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ RefPtr<SourceBufferPrivateAVFObjC> protectedSourceBuffer;
+ for (auto& sourceBuffer : m_sourceBuffers) {
+ if (sourceBuffer->protectedTrackID() != -1) {
+ protectedSourceBuffer = sourceBuffer;
+ break;
+ }
+ }
+
</ins><span class="cx"> if (shouldGenerateKeyRequest) {
</span><span class="cx"> RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
</span><span class="cx"> if (getAVStreamSessionClass()) {
</span><span class="cx"> m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithAppIdentifier:certificateData.get()]);
</span><del>- [m_streamSession addStreamDataParser:m_parent->parser()];
</del><ins>+ for (auto& sourceBuffer : m_sourceBuffers)
+ [m_streamSession addStreamDataParser:sourceBuffer->parser()];
</ins><span class="cx"> LOG(Media, "CDMSessionMediaSourceAVFObjC::update(%p) - created stream session %p", this, m_streamSession.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (m_sourceBuffers.isEmpty())
+ return true;
+
+ if (!protectedSourceBuffer)
+ return true;
+
</ins><span class="cx"> RetainPtr<NSData> initData = adoptNS([[NSData alloc] initWithBytes:m_initData->data() length:m_initData->length()]);
</span><span class="cx">
</span><span class="cx"> NSError* error = nil;
</span><del>- RetainPtr<NSData> request = [m_parent->parser() streamingContentKeyRequestDataForApp:certificateData.get() contentIdentifier:initData.get() trackID:m_parent->protectedTrackID() options:nil error:&error];
</del><ins>+ RetainPtr<NSData> request = [protectedSourceBuffer->parser() streamingContentKeyRequestDataForApp:certificateData.get() contentIdentifier:initData.get() trackID:protectedSourceBuffer->protectedTrackID() options:nil error:&error];
</ins><span class="cx">
</span><span class="cx"> if (error) {
</span><span class="cx"> LOG(Media, "CDMSessionMediaSourceAVFObjC::update(%p) - error:%@", this, [error description]);
</span><span class="lines">@@ -159,11 +170,12 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ASSERT(!m_sourceBuffers.isEmpty());
</ins><span class="cx"> LOG(Media, "CDMSessionMediaSourceAVFObjC::update(%p) - key data", this);
</span><span class="cx"> errorCode = MediaPlayer::NoError;
</span><span class="cx"> systemCode = 0;
</span><span class="cx"> RetainPtr<NSData> keyData = adoptNS([[NSData alloc] initWithBytes:key->data() length:key->length()]);
</span><del>- [m_parent->parser() processContentKeyResponseData:keyData.get() forTrackID:m_parent->protectedTrackID()];
</del><ins>+ [protectedSourceBuffer->parser() processContentKeyResponseData:keyData.get() forTrackID:protectedSourceBuffer->protectedTrackID()];
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -183,6 +195,30 @@
</span><span class="cx"> m_client->sendError(CDMSessionClient::MediaKeyErrorDomain, abs([error code]));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CDMSessionMediaSourceAVFObjC::addSourceBuffer(SourceBufferPrivateAVFObjC* sourceBuffer)
+{
+ ASSERT(!m_sourceBuffers.contains(sourceBuffer));
+ ASSERT(sourceBuffer);
+
+ m_sourceBuffers.append(sourceBuffer);
+ sourceBuffer->registerForErrorNotifications(this);
+
+ if (m_streamSession)
+ [m_streamSession addStreamDataParser:sourceBuffer->parser()];
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void CDMSessionMediaSourceAVFObjC::removeSourceBuffer(SourceBufferPrivateAVFObjC* sourceBuffer)
+{
+ ASSERT(m_sourceBuffers.contains(sourceBuffer));
+ ASSERT(sourceBuffer);
+
+ if (m_streamSession)
+ [m_streamSession removeStreamDataParser:sourceBuffer->parser()];
+
+ sourceBuffer->unregisterForErrorNotifications(this);
+ m_sourceBuffers.remove(m_sourceBuffers.find(sourceBuffer));
+}
+
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaSourceAVFObjCh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class CDMSessionMediaSourceAVFObjC;
</ins><span class="cx"> class PlatformClockCM;
</span><span class="cx"> class MediaSourcePrivateAVFObjC;
</span><span class="cx">
</span><span class="lines">@@ -53,6 +54,12 @@
</span><span class="cx">
</span><span class="cx"> static void registerMediaEngine(MediaEngineRegistrar);
</span><span class="cx">
</span><ins>+ // MediaPlayer Factory Methods
+ static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
+ static bool isAvailable();
+ static void getSupportedTypes(HashSet<String>& types);
+ static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
+
</ins><span class="cx"> void addDisplayLayer(AVSampleBufferDisplayLayer*);
</span><span class="cx"> void removeDisplayLayer(AVSampleBufferDisplayLayer*);
</span><span class="cx">
</span><span class="lines">@@ -75,7 +82,7 @@
</span><span class="cx"> void sizeChanged();
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><del>- virtual std::unique_ptr<CDMSession> createSession(const String&);
</del><ins>+ virtual void setCDMSession(CDMSession*) override;
</ins><span class="cx"> void keyNeeded(Uint8Array*);
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -161,13 +168,6 @@
</span><span class="cx"> bool shouldBePlaying() const;
</span><span class="cx"> void seekTimerFired(Timer<MediaPlayerPrivateMediaSourceAVFObjC>&);
</span><span class="cx">
</span><del>- // MediaPlayer Factory Methods
- static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
- static bool isAvailable();
- static void getSupportedTypes(HashSet<String>& types);
- static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
- static bool supportsKeySystem(const String& keySystem, const String& mimeType);
-
</del><span class="cx"> friend class MediaSourcePrivateAVFObjC;
</span><span class="cx">
</span><span class="cx"> struct PendingSeek {
</span><span class="lines">@@ -193,6 +193,7 @@
</span><span class="cx"> RetainPtr<id> m_timeJumpedObserver;
</span><span class="cx"> RetainPtr<id> m_durationObserver;
</span><span class="cx"> Timer<MediaPlayerPrivateMediaSourceAVFObjC> m_seekTimer;
</span><ins>+ CDMSessionMediaSourceAVFObjC* m_session;
</ins><span class="cx"> MediaPlayer::NetworkState m_networkState;
</span><span class="cx"> MediaPlayer::ReadyState m_readyState;
</span><span class="cx"> MediaTime m_lastSeekTime;
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaSourceAVFObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)
</span><span class="cx">
</span><del>-#import "CDMSession.h"
</del><ins>+#import "CDMSessionMediaSourceAVFObjC.h"
</ins><span class="cx"> #import "Logging.h"
</span><span class="cx"> #import "MediaSourcePrivateAVFObjC.h"
</span><span class="cx"> #import "MediaSourcePrivateClient.h"
</span><span class="lines">@@ -136,6 +136,7 @@
</span><span class="cx"> , m_weakPtrFactory(this)
</span><span class="cx"> , m_synchronizer(adoptNS([[getAVSampleBufferRenderSynchronizerClass() alloc] init]))
</span><span class="cx"> , m_seekTimer(this, &MediaPlayerPrivateMediaSourceAVFObjC::seekTimerFired)
</span><ins>+ , m_session(nullptr)
</ins><span class="cx"> , m_networkState(MediaPlayer::Empty)
</span><span class="cx"> , m_readyState(MediaPlayer::HaveNothing)
</span><span class="cx"> , m_rate(1)
</span><span class="lines">@@ -194,7 +195,7 @@
</span><span class="cx"> void MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine(MediaEngineRegistrar registrar)
</span><span class="cx"> {
</span><span class="cx"> if (isAvailable())
</span><del>- registrar(create, getSupportedTypes, supportsType, 0, 0, 0, supportsKeySystem);
</del><ins>+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateMediaSourceAVFObjC::create(MediaPlayer* player)
</span><span class="lines">@@ -233,20 +234,8 @@
</span><span class="cx"> types = mimeTypeCache();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(ENCRYPTED_MEDIA_V2)
-static bool keySystemIsSupported(const String& keySystem)
-{
- return equalIgnoringCase(keySystem, "com.apple.fps.2_0");
-}
-#endif
-
</del><span class="cx"> MediaPlayer::SupportsType MediaPlayerPrivateMediaSourceAVFObjC::supportsType(const MediaEngineSupportParameters& parameters)
</span><span class="cx"> {
</span><del>-#if ENABLE(ENCRYPTED_MEDIA_V2)
- if (!parameters.keySystem.isEmpty() && !keySystemIsSupported(parameters.keySystem))
- return MediaPlayer::IsNotSupported;
-#endif
-
</del><span class="cx"> // This engine does not support non-media-source sources.
</span><span class="cx"> if (!parameters.isMediaSource)
</span><span class="cx"> return MediaPlayer::IsNotSupported;
</span><span class="lines">@@ -263,28 +252,6 @@
</span><span class="cx"> return [getAVURLAssetClass() isPlayableExtendedMIMEType:typeString] ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool MediaPlayerPrivateMediaSourceAVFObjC::supportsKeySystem(const String& keySystem, const String& mimeType)
-{
-#if ENABLE(ENCRYPTED_MEDIA_V2)
- if (!wkQueryDecoderAvailability())
- return false;
-
- if (!keySystem.isEmpty()) {
- if (!keySystemIsSupported(keySystem))
- return false;
-
- if (!mimeType.isEmpty() && !mimeTypeCache().contains(mimeType))
- return false;
-
- return true;
- }
-#else
- UNUSED_PARAM(keySystem);
- UNUSED_PARAM(mimeType);
-#endif
- return false;
-}
-
</del><span class="cx"> #pragma mark -
</span><span class="cx"> #pragma mark MediaPlayerPrivateInterface Overrides
</span><span class="cx">
</span><span class="lines">@@ -692,12 +659,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><del>-std::unique_ptr<CDMSession> MediaPlayerPrivateMediaSourceAVFObjC::createSession(const String& keySystem)
</del><ins>+void MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession(CDMSession* session)
</ins><span class="cx"> {
</span><del>- if (!m_mediaSourcePrivate)
- return nullptr;
</del><ins>+ if (m_session) {
+ for (auto& sourceBuffer : m_mediaSourcePrivate->sourceBuffers())
+ m_session->removeSourceBuffer(sourceBuffer.get());
+ m_session = nullptr;
+ }
</ins><span class="cx">
</span><del>- return m_mediaSourcePrivate->createSession(keySystem);
</del><ins>+ m_session = toCDMSessionMediaSourceAVFObjC(session);
+
+ if (m_session) {
+ for (auto& sourceBuffer : m_mediaSourcePrivate->sourceBuffers())
+ m_session->addSourceBuffer(sourceBuffer.get());
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaPlayerPrivateMediaSourceAVFObjC::keyNeeded(Uint8Array* initData)
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaSourcePrivateAVFObjCh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> virtual ~MediaSourcePrivateAVFObjC();
</span><span class="cx">
</span><span class="cx"> MediaPlayerPrivateMediaSourceAVFObjC* player() const { return m_player; }
</span><ins>+ const Vector<RefPtr<SourceBufferPrivateAVFObjC>>& sourceBuffers() const { return m_sourceBuffers; }
</ins><span class="cx"> const Vector<SourceBufferPrivateAVFObjC*>& activeSourceBuffers() const { return m_activeSourceBuffers; }
</span><span class="cx">
</span><span class="cx"> virtual AddStatus addSourceBuffer(const ContentType&, RefPtr<SourceBufferPrivate>&) override;
</span><span class="lines">@@ -76,10 +77,6 @@
</span><span class="cx"> MediaTime fastSeekTimeForMediaTime(const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold);
</span><span class="cx"> IntSize naturalSize() const;
</span><span class="cx">
</span><del>-#if ENABLE(ENCRYPTED_MEDIA_V2)
- std::unique_ptr<CDMSession> createSession(const String&);
-#endif
-
</del><span class="cx"> private:
</span><span class="cx"> MediaSourcePrivateAVFObjC(MediaPlayerPrivateMediaSourceAVFObjC*, MediaSourcePrivateClient*);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6005branchSourceWebCoreplatformgraphicsavfoundationobjcMediaSourcePrivateAVFObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (178445 => 178446)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm        2015-01-14 22:16:25 UTC (rev 178445)
+++ branches/safari-600.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm        2015-01-14 22:20:48 UTC (rev 178446)
</span><span class="lines">@@ -153,18 +153,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><del>-std::unique_ptr<CDMSession> MediaSourcePrivateAVFObjC::createSession(const String&)
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
- if (m_sourceBuffersNeedingSessions.isEmpty())
- return nullptr;
- return std::make_unique<CDMSessionMediaSourceAVFObjC>(m_sourceBuffersNeedingSessions.takeFirst());
-#endif
- return nullptr;
-}
-#endif
-
-#if ENABLE(ENCRYPTED_MEDIA_V2)
</del><span class="cx"> void MediaSourcePrivateAVFObjC::sourceBufferKeyNeeded(SourceBufferPrivateAVFObjC* buffer, Uint8Array* initData)
</span><span class="cx"> {
</span><span class="cx"> m_sourceBuffersNeedingSessions.append(buffer);
</span></span></pre>
</div>
</div>
</body>
</html>