<!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>[168947] branches/safari-538.34.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/168947">168947</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-05-16 00:53:58 -0700 (Fri, 16 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/168755">r168755</a>. </pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari538345branchSourceWebCoreChangeLog">branches/safari-538.34.5-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari538345branchSourceWebCorehtmlHTMLMediaElementcpp">branches/safari-538.34.5-branch/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcAudioTrackPrivateAVFObjCmm">branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm</a></li>
<li><a href="#branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh">branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h</a></li>
<li><a href="#branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
<li><a href="#branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcVideoTrackPrivateAVFObjCcpp">branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari538345branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34.5-branch/Source/WebCore/ChangeLog (168946 => 168947)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34.5-branch/Source/WebCore/ChangeLog        2014-05-16 07:52:34 UTC (rev 168946)
+++ branches/safari-538.34.5-branch/Source/WebCore/ChangeLog        2014-05-16 07:53:58 UTC (rev 168947)
</span><span class="lines">@@ -1,5 +1,53 @@
</span><span class="cx"> 2014-05-16 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><ins>+ Merge r168755
+
+ 2014-05-13 Eric Carlson <eric.carlson@apple.com>
+
+ [Mac] hasVideo should return true when video is ready to display
+ https://bugs.webkit.org/show_bug.cgi?id=132885
+
+ Reviewed by Jer Noble.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::parseAttribute):
+
+ * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm:
+ (WebCore::AudioTrackPrivateAVFObjC::resetPropertiesFromTrack): Don't change the
+ enabled state of the AVPlayerItemTrack during setup.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Initialize
+ m_cachedIsReadyForDisplay.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): Remove "enabled" KVO observers.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Observe "readyForDisplay"
+ change notifications.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): Remove for "readyForDisplay"
+ observer.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame): Return cached readyForDisplay
+ state instead of polling every time.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Call setHasVideo(true) if the
+ player layer is ready for display.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): Update logging.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): Ditto.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::firstFrameAvailableDidChange): Cache readyForDisplay
+ state, call tracksChanged() if we haven't seen a video track yet.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::trackEnabledDidChange): New.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive): Correct logging.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksDidChange): Remove old "enabled" listeners
+ before release tracks, add new ones to new tracks.
+ (WebCore::assetTrackMetadataKeyNames): Add "enabled" to the list of properties we require to
+ be loaded before announcing that metadata has loaded.
+ (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): Observe
+ "readyForDisplay" and "enabled".
+
+ * platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp:
+ (WebCore::VideoTrackPrivateAVFObjC::resetPropertiesFromTrack): Don't change the
+ enabled state of the AVPlayerItemTrack during setup.
+
+2014-05-16 Lucas Forschler <lforschler@apple.com>
+
</ins><span class="cx"> Merge r168744
</span><span class="cx">
</span><span class="cx"> 2014-05-13 Enrica Casucci <enrica@apple.com>
</span></span></pre></div>
<a id="branchessafari538345branchSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34.5-branch/Source/WebCore/html/HTMLMediaElement.cpp (168946 => 168947)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34.5-branch/Source/WebCore/html/HTMLMediaElement.cpp        2014-05-16 07:52:34 UTC (rev 168946)
+++ branches/safari-538.34.5-branch/Source/WebCore/html/HTMLMediaElement.cpp        2014-05-16 07:53:58 UTC (rev 168947)
</span><span class="lines">@@ -4235,7 +4235,8 @@
</span><span class="cx">
</span><span class="cx"> void HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(MediaPlayer*)
</span><span class="cx"> {
</span><del>- LOG(Media, "HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable");
</del><ins>+ LOG(Media, "HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(%p) - current display mode = %i", this, (int)displayMode());
+
</ins><span class="cx"> beginProcessingMediaPlayerCallback();
</span><span class="cx"> if (displayMode() == PosterWaitingForVideo) {
</span><span class="cx"> setDisplayMode(Video);
</span><span class="lines">@@ -4255,6 +4256,11 @@
</span><span class="cx"> markCaptionAndSubtitleTracksAsUnconfigured(AfterDelay);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ if (potentiallyPlaying() && displayMode() == PosterWaitingForVideo) {
+ setDisplayMode(Video);
+ mediaPlayerRenderingModeChanged(m_player.get());
+ }
+
</ins><span class="cx"> if (hasMediaControls())
</span><span class="cx"> mediaControls()->reset();
</span><span class="cx"> if (renderer())
</span></span></pre></div>
<a id="branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcAudioTrackPrivateAVFObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm (168946 => 168947)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm        2014-05-16 07:52:34 UTC (rev 168946)
+++ branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm        2014-05-16 07:53:58 UTC (rev 168947)
</span><span class="lines">@@ -39,7 +39,10 @@
</span><span class="cx">
</span><span class="cx"> void AudioTrackPrivateAVFObjC::resetPropertiesFromTrack()
</span><span class="cx"> {
</span><del>- setEnabled(m_impl->enabled());
</del><ins>+ // Don't call this->setEnabled() because it also sets the enabled state of the
+ // AVPlayerItemTrack
+ AudioTrackPrivateAVF::setEnabled(m_impl->enabled());
+
</ins><span class="cx"> setKind(m_impl->audioKind());
</span><span class="cx"> setId(m_impl->id());
</span><span class="cx"> setLabel(m_impl->label());
</span></span></pre></div>
<a id="branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (168946 => 168947)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2014-05-16 07:52:34 UTC (rev 168946)
+++ branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2014-05-16 07:53:58 UTC (rev 168947)
</span><span class="lines">@@ -110,6 +110,8 @@
</span><span class="cx"> void durationDidChange(double);
</span><span class="cx"> void rateDidChange(double);
</span><span class="cx"> void metadataDidArrive(RetainPtr<NSArray>, double);
</span><ins>+ void firstFrameAvailableDidChange(bool);
+ void trackEnabledDidChange(bool);
</ins><span class="cx">
</span><span class="cx"> virtual void setShouldBufferData(bool);
</span><span class="cx">
</span><span class="lines">@@ -331,6 +333,7 @@
</span><span class="cx"> bool m_cachedBufferFull;
</span><span class="cx"> bool m_cachedHasEnabledAudio;
</span><span class="cx"> bool m_shouldBufferData;
</span><ins>+ bool m_cachedIsReadyForDisplay;
</ins><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><span class="cx"> mutable bool m_allowsWirelessVideoPlayback;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (168946 => 168947)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2014-05-16 07:52:34 UTC (rev 168946)
+++ branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2014-05-16 07:53:58 UTC (rev 168947)
</span><span class="lines">@@ -246,7 +246,9 @@
</span><span class="cx">
</span><span class="cx"> enum MediaPlayerAVFoundationObservationContext {
</span><span class="cx"> MediaPlayerAVFoundationObservationContextPlayerItem,
</span><del>- MediaPlayerAVFoundationObservationContextPlayer
</del><ins>+ MediaPlayerAVFoundationObservationContextPlayerItemTrack,
+ MediaPlayerAVFoundationObservationContextPlayer,
+ MediaPlayerAVFoundationObservationContextAVPlayerLayer,
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) && HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
</span><span class="lines">@@ -375,6 +377,7 @@
</span><span class="cx"> , m_cachedBufferFull(false)
</span><span class="cx"> , m_cachedHasEnabledAudio(false)
</span><span class="cx"> , m_shouldBufferData(true)
</span><ins>+ , m_cachedIsReadyForDisplay(false)
</ins><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><span class="cx"> , m_allowsWirelessVideoPlayback(true)
</span><span class="cx"> #endif
</span><span class="lines">@@ -452,11 +455,14 @@
</span><span class="cx"> m_cachedItemStatus = MediaPlayerAVPlayerItemStatusDoesNotExist;
</span><span class="cx"> m_cachedSeekableRanges = nullptr;
</span><span class="cx"> m_cachedLoadedRanges = nullptr;
</span><del>- m_cachedTracks = nullptr;
</del><span class="cx"> m_cachedHasEnabledAudio = false;
</span><span class="cx"> m_cachedPresentationSize = FloatSize();
</span><span class="cx"> m_cachedDuration = 0;
</span><span class="cx">
</span><ins>+ for (AVPlayerItemTrack *track in m_cachedTracks.get())
+ [track removeObserver:m_objcObserver.get() forKeyPath:@"enabled"];
+ m_cachedTracks = nullptr;
+
</ins><span class="cx"> setIgnoreLoadStateChanges(false);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -537,6 +543,7 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> [m_videoLayer.get() setName:@"MediaPlayerPrivate AVPlayerLayer"];
</span><span class="cx"> #endif
</span><ins>+ [m_videoLayer.get() addObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextAVPlayerLayer];
</ins><span class="cx"> updateVideoLayerGravity();
</span><span class="cx"> LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createVideoLayer(%p) - returning %p", this, m_videoLayer.get());
</span><span class="cx">
</span><span class="lines">@@ -557,6 +564,7 @@
</span><span class="cx">
</span><span class="cx"> LOG(Media, "MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer(%p) - destroying %p", this, m_videoLayer.get());
</span><span class="cx">
</span><ins>+ [m_videoLayer.get() removeObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay"];
</ins><span class="cx"> [m_videoLayer.get() setPlayer:nil];
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -570,7 +578,7 @@
</span><span class="cx"> bool MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame() const
</span><span class="cx"> {
</span><span class="cx"> if (currentRenderingMode() == MediaRenderingToLayer)
</span><del>- return m_videoLayer && [m_videoLayer.get() isReadyForDisplay];
</del><ins>+ return m_cachedIsReadyForDisplay;
</ins><span class="cx">
</span><span class="cx"> return m_videoFrameHasDrawn;
</span><span class="cx"> }
</span><span class="lines">@@ -1485,7 +1493,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- setHasVideo(hasVideo);
</del><ins>+ // Always says we have video if the AVPlayerLayer is ready for diaplay to work around
+ // an AVFoundation bug which causes it to sometimes claim a track is disabled even
+ // when it is not.
+ setHasVideo(hasVideo || m_cachedIsReadyForDisplay);
+
</ins><span class="cx"> setHasAudio(hasAudio);
</span><span class="cx"> #if ENABLE(DATACUE_VALUE)
</span><span class="cx"> if (hasMetaData)
</span><span class="lines">@@ -1516,7 +1528,7 @@
</span><span class="cx">
</span><span class="cx"> setHasClosedCaptions(hasCaptions);
</span><span class="cx">
</span><del>- LOG(Media, "WebCoreAVFMovieObserver:tracksChanged(%p) - hasVideo = %s, hasAudio = %s, hasCaptions = %s",
</del><ins>+ LOG(Media, "MediaPlayerPrivateAVFoundation:tracksChanged(%p) - hasVideo = %s, hasAudio = %s, hasCaptions = %s",
</ins><span class="cx"> this, boolString(hasVideo()), boolString(hasAudio()), boolString(hasClosedCaptions()));
</span><span class="cx">
</span><span class="cx"> sizeChanged();
</span><span class="lines">@@ -1571,12 +1583,28 @@
</span><span class="cx">
</span><span class="cx"> void MediaPlayerPrivateAVFoundationObjC::updateAudioTracks()
</span><span class="cx"> {
</span><ins>+#if !LOG_DISABLED
+ size_t count = m_audioTracks.size();
+#endif
+
</ins><span class="cx"> determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeAudio, m_audioTracks, &AudioTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeAudioTrack, &MediaPlayer::addAudioTrack);
</span><ins>+
+#if !LOG_DISABLED
+ LOG(Media, "MediaPlayerPrivateAVFoundationObjC::updateAudioTracks(%p) - audio track count was %lu, is %lu", this, count, m_audioTracks.size());
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaPlayerPrivateAVFoundationObjC::updateVideoTracks()
</span><span class="cx"> {
</span><ins>+#if !LOG_DISABLED
+ size_t count = m_videoTracks.size();
+#endif
+
</ins><span class="cx"> determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeVideo, m_videoTracks, &VideoTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack);
</span><ins>+
+#if !LOG_DISABLED
+ LOG(Media, "MediaPlayerPrivateAVFoundationObjC::updateVideoTracks(%p) - video track count was %lu, is %lu", this, count, m_videoTracks.size());
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
</span><span class="lines">@@ -2311,6 +2339,20 @@
</span><span class="cx"> updateStates();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MediaPlayerPrivateAVFoundationObjC::firstFrameAvailableDidChange(bool isReady)
+{
+ m_cachedIsReadyForDisplay = isReady;
+ if (!hasVideo() && isReady)
+ tracksChanged();
+ updateStates();
+}
+
+void MediaPlayerPrivateAVFoundationObjC::trackEnabledDidChange(bool)
+{
+ tracksChanged();
+ updateStates();
+}
+
</ins><span class="cx"> void MediaPlayerPrivateAVFoundationObjC::setShouldBufferData(bool shouldBuffer)
</span><span class="cx"> {
</span><span class="cx"> LOG(Media, "MediaPlayerPrivateAVFoundationObjC::shouldBufferData(%p) - %s", this, boolString(shouldBuffer));
</span><span class="lines">@@ -2356,7 +2398,7 @@
</span><span class="cx"> {
</span><span class="cx"> m_currentMetaData = metadata && ![metadata isKindOfClass:[NSNull class]] ? metadata : nil;
</span><span class="cx">
</span><del>- LOG(Media, "MediaPlayerPrivateAVFoundationObjC::metadataDidArrive(%p) - adding %i cues at time %.2f", this, m_currentMetaData ? [m_currentMetaData.get() count] : 0, mediaTime);
</del><ins>+ LOG(Media, "MediaPlayerPrivateAVFoundationObjC::metadataDidArrive(%p) - adding %i cues at time %.2f", this, m_currentMetaData ? static_cast<int>[m_currentMetaData.get() count] : 0, mediaTime);
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(DATACUE_VALUE)
</span><span class="cx"> if (seeking())
</span><span class="lines">@@ -2396,7 +2438,13 @@
</span><span class="cx">
</span><span class="cx"> void MediaPlayerPrivateAVFoundationObjC::tracksDidChange(RetainPtr<NSArray> tracks)
</span><span class="cx"> {
</span><ins>+ for (AVPlayerItemTrack *track in m_cachedTracks.get())
+ [track removeObserver:m_objcObserver.get() forKeyPath:@"enabled"];
+
</ins><span class="cx"> m_cachedTracks = tracks;
</span><ins>+ for (AVPlayerItemTrack *track in m_cachedTracks.get())
+ [track addObserver:m_objcObserver.get() forKeyPath:@"enabled" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextPlayerItemTrack];
+
</ins><span class="cx"> m_cachedTotalBytes = 0;
</span><span class="cx">
</span><span class="cx"> tracksChanged();
</span><span class="lines">@@ -2481,7 +2529,7 @@
</span><span class="cx">
</span><span class="cx"> NSArray* assetTrackMetadataKeyNames()
</span><span class="cx"> {
</span><del>- static NSArray* keys = [[NSArray alloc] initWithObjects:@"totalSampleDataLength", @"mediaType", nil];
</del><ins>+ static NSArray* keys = [[NSArray alloc] initWithObjects:@"totalSampleDataLength", @"mediaType", @"enabled", nil];
</ins><span class="cx">
</span><span class="cx"> return keys;
</span><span class="cx"> }
</span><span class="lines">@@ -2535,6 +2583,16 @@
</span><span class="cx">
</span><span class="cx"> WTF::Function<void ()> function;
</span><span class="cx">
</span><ins>+ if (context == MediaPlayerAVFoundationObservationContextAVPlayerLayer) {
+ if ([keyPath isEqualToString:@"readyForDisplay"])
+ function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::firstFrameAvailableDidChange, m_callback, [newValue boolValue]);
+ }
+
+ if (context == MediaPlayerAVFoundationObservationContextPlayerItemTrack) {
+ if ([keyPath isEqualToString:@"enabled"])
+ function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::trackEnabledDidChange, m_callback, [newValue boolValue]);
+ }
+
</ins><span class="cx"> if (context == MediaPlayerAVFoundationObservationContextPlayerItem && willChange) {
</span><span class="cx"> if ([keyPath isEqualToString:@"playbackLikelyToKeepUp"])
</span><span class="cx"> function = WTF::bind(&MediaPlayerPrivateAVFoundationObjC::playbackLikelyToKeepUpWillChange, m_callback);
</span></span></pre></div>
<a id="branchessafari538345branchSourceWebCoreplatformgraphicsavfoundationobjcVideoTrackPrivateAVFObjCcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp (168946 => 168947)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp        2014-05-16 07:52:34 UTC (rev 168946)
+++ branches/safari-538.34.5-branch/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateAVFObjC.cpp        2014-05-16 07:53:58 UTC (rev 168947)
</span><span class="lines">@@ -45,7 +45,10 @@
</span><span class="cx">
</span><span class="cx"> void VideoTrackPrivateAVFObjC::resetPropertiesFromTrack()
</span><span class="cx"> {
</span><del>- setSelected(m_impl->enabled());
</del><ins>+ // Don't call this->setSelected() because it also sets the enabled state of the
+ // AVPlayerItemTrack
+ VideoTrackPrivateAVF::setSelected(m_impl->enabled());
+
</ins><span class="cx"> setKind(m_impl->videoKind());
</span><span class="cx"> setId(m_impl->id());
</span><span class="cx"> setLabel(m_impl->label());
</span></span></pre>
</div>
</div>
</body>
</html>