Title: [175826] trunk
Revision
175826
Author
jer.no...@apple.com
Date
2014-11-10 12:43:50 -0800 (Mon, 10 Nov 2014)

Log Message

REGRESSION(r174823): Several tests fail due to canplaythrough firing before tracks are available
https://bugs.webkit.org/show_bug.cgi?id=137882

Reviewed by Eric Carlson.

Source/WebCore:

For HLS streams with only one video, audio, or text track, there will be no media selection group
for that media characteristic. When culling out AVPlayerItemTracks in tracksDidChange(), do not skip
tracks for which there is no matching AVMediaSelectionGroup.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::hasLoadedMediaSelectionGroups): Refactored.
(WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForLegibleMedia): Call above.
(WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForAudibleMedia): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForVisualMedia): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksDidChange):

LayoutTests:

* platform/mac/TestExpectations:
* platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (175825 => 175826)


--- trunk/LayoutTests/ChangeLog	2014-11-10 20:39:24 UTC (rev 175825)
+++ trunk/LayoutTests/ChangeLog	2014-11-10 20:43:50 UTC (rev 175826)
@@ -1,3 +1,13 @@
+2014-11-04  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION(r174823): Several tests fail due to canplaythrough firing before tracks are available
+        https://bugs.webkit.org/show_bug.cgi?id=137882
+
+        Reviewed by Eric Carlson.
+
+        * platform/mac/TestExpectations:
+        * platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt:
+
 2014-11-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r175813.

Modified: trunk/LayoutTests/platform/mac/TestExpectations (175825 => 175826)


--- trunk/LayoutTests/platform/mac/TestExpectations	2014-11-10 20:39:24 UTC (rev 175825)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2014-11-10 20:43:50 UTC (rev 175826)
@@ -1502,9 +1502,7 @@
 [ Yosemite ] inspector/model/parse-script-syntax-tree.html [ Failure Crash ]
 [ Yosemite ] inspector/protocol-promise-result.html [ Failure Crash ]
 
-webkit.org/b/137882 http/tests/media/hls/video-controls-live-stream.html [ Failure ]
-webkit.org/b/137882 http/tests/media/track-in-band-hls-metadata.html [ Failure ]
-webkit.org/b/137882 media/track/audio-track.html [ Pass Failure ]
+webkit.org/b/138394 media/track/audio-track.html [ Pass Failure ]
 
 # Specific to Yosemite's font fallback
 webkit.org/b/138328 [ Mavericks MountainLion ] platform/mac/fast/text/font-cursive-italic-cjk.html [ Skip ]

Modified: trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt (175825 => 175826)


--- trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt	2014-11-10 20:39:24 UTC (rev 175825)
+++ trunk/LayoutTests/platform/mac/http/tests/media/hls/video-controls-live-stream-expected.txt	2014-11-10 20:43:50 UTC (rev 175826)
@@ -2,7 +2,6 @@
 EVENT(play)
 EXPECTED (video.duration == 'Infinity') OK
 -webkit-media-text-track-container: classes: [hidden]
--webkit-media-controls-panel-composited-parent: classes: []
 -webkit-media-controls-panel: classes: [paused]
 -webkit-media-controls-play-button: classes: [paused]
 -webkit-media-controls-status-display: classes: []

Modified: trunk/Source/WebCore/ChangeLog (175825 => 175826)


--- trunk/Source/WebCore/ChangeLog	2014-11-10 20:39:24 UTC (rev 175825)
+++ trunk/Source/WebCore/ChangeLog	2014-11-10 20:43:50 UTC (rev 175826)
@@ -1,3 +1,22 @@
+2014-11-04  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION(r174823): Several tests fail due to canplaythrough firing before tracks are available
+        https://bugs.webkit.org/show_bug.cgi?id=137882
+
+        Reviewed by Eric Carlson.
+
+        For HLS streams with only one video, audio, or text track, there will be no media selection group
+        for that media characteristic. When culling out AVPlayerItemTracks in tracksDidChange(), do not skip
+        tracks for which there is no matching AVMediaSelectionGroup.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::hasLoadedMediaSelectionGroups): Refactored.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForLegibleMedia): Call above.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForAudibleMedia): Ditto.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForVisualMedia): Ditto.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksDidChange):
+
 2014-11-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r175813.

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (175825 => 175826)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2014-11-10 20:39:24 UTC (rev 175825)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2014-11-10 20:43:50 UTC (rev 175826)
@@ -245,6 +245,8 @@
 
 #if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
     void processMediaSelectionOptions();
+    bool hasLoadedMediaSelectionGroups();
+
     AVMediaSelectionGroup* safeMediaSelectionGroupForLegibleMedia();
     AVMediaSelectionGroup* safeMediaSelectionGroupForAudibleMedia();
     AVMediaSelectionGroup* safeMediaSelectionGroupForVisualMedia();

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (175825 => 175826)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-11-10 20:39:24 UTC (rev 175825)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-11-10 20:43:50 UTC (rev 175826)
@@ -2328,36 +2328,38 @@
 #endif
 
 #if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP)
-AVMediaSelectionGroupType* MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForLegibleMedia()
+bool MediaPlayerPrivateAVFoundationObjC::hasLoadedMediaSelectionGroups()
 {
     if (!m_avAsset)
-        return nil;
-    
+        return false;
+
     if ([m_avAsset.get() statusOfValueForKey:@"availableMediaCharacteristicsWithMediaSelectionOptions" error:NULL] != AVKeyValueStatusLoaded)
+        return false;
+
+    return true;
+}
+
+AVMediaSelectionGroupType* MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForLegibleMedia()
+{
+    if (!hasLoadedMediaSelectionGroups())
         return nil;
-    
+
     return [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
 }
 
 AVMediaSelectionGroupType* MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForAudibleMedia()
 {
-    if (!m_avAsset)
+    if (!hasLoadedMediaSelectionGroups())
         return nil;
 
-    if ([m_avAsset.get() statusOfValueForKey:@"availableMediaCharacteristicsWithMediaSelectionOptions" error:NULL] != AVKeyValueStatusLoaded)
-        return nil;
-
     return [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible];
 }
 
 AVMediaSelectionGroupType* MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForVisualMedia()
 {
-    if (!m_avAsset)
+    if (!hasLoadedMediaSelectionGroups())
         return nil;
 
-    if ([m_avAsset.get() statusOfValueForKey:@"availableMediaCharacteristicsWithMediaSelectionOptions" error:NULL] != AVKeyValueStatusLoaded)
-        return nil;
-
     return [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicVisual];
 }
 
@@ -2753,10 +2755,26 @@
 
     NSArray *assetTracks = [m_avAsset tracks];
 
-    // Tracks which are not present in the AVAsset are streaming tracks, and will instead be represented by
-    // AVMediaSelectionOptions.
     m_cachedTracks = [tracks objectsAtIndexes:[tracks indexesOfObjectsPassingTest:^(id obj, NSUInteger, BOOL*) {
-        return [assetTracks containsObject:[obj assetTrack]];
+        AVAssetTrack* assetTrack = [obj assetTrack];
+
+        if ([assetTracks containsObject:assetTrack])
+            return YES;
+
+        // Track is a streaming track. Omit if it belongs to a valid AVMediaSelectionGroup.
+        if (!hasLoadedMediaSelectionGroups())
+            return NO;
+
+        if ([assetTrack hasMediaCharacteristic:AVMediaCharacteristicAudible] && safeMediaSelectionGroupForAudibleMedia())
+            return NO;
+
+        if ([assetTrack hasMediaCharacteristic:AVMediaCharacteristicVisual] && safeMediaSelectionGroupForVisualMedia())
+            return NO;
+
+        if ([assetTrack hasMediaCharacteristic:AVMediaCharacteristicLegible] && safeMediaSelectionGroupForLegibleMedia())
+            return NO;
+
+        return YES;
     }]];
 
     for (AVPlayerItemTrack *track in m_cachedTracks.get())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to