Don't disconnect WebAVPlayerController from its delegate since there is no way to...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2016 22:03:45 +0000 (22:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2016 22:03:45 +0000 (22:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157337

Patch by Jeremy Jones <jeremyj@apple.com> on 2016-05-04
Reviewed by Jer Noble.

WebAVPlayerController used to be deleted and recreated each time we begin fullscreen video mode.
Since it is now preserved, we shouldn't paritally tear it down in cleanupFullscreen by disconnecting it
from its delegate, especially since we have no way to reconnect it.

The side effect of leaving it connected is that it can continue to make callbacks during cleanup.
Of importance is that it sets the audio and legible media selctions to nil. We don't want to change
the selection as a result of teardown. Nil selection is unsupported by WebVideoFullscreenModelVideoElement
and causes an assert. This transition to nil selection is now ignored.

* platform/ios/WebAVPlayerController.mm:
(-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]):
(-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]):
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::cleanupFullscreen):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/WebAVPlayerController.mm
Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm

index 11caeae..bec4cb1 100644 (file)
@@ -1,3 +1,25 @@
+2016-05-04  Jeremy Jones  <jeremyj@apple.com>
+
+        Don't disconnect WebAVPlayerController from its delegate since there is no way to reconnect it.
+        https://bugs.webkit.org/show_bug.cgi?id=157337
+
+        Reviewed by Jer Noble.
+
+        WebAVPlayerController used to be deleted and recreated each time we begin fullscreen video mode.
+        Since it is now preserved, we shouldn't paritally tear it down in cleanupFullscreen by disconnecting it
+        from its delegate, especially since we have no way to reconnect it.
+
+        The side effect of leaving it connected is that it can continue to make callbacks during cleanup.
+        Of importance is that it sets the audio and legible media selctions to nil. We don't want to change 
+        the selection as a result of teardown. Nil selection is unsupported by WebVideoFullscreenModelVideoElement
+        and causes an assert. This transition to nil selection is now ignored.
+
+        * platform/ios/WebAVPlayerController.mm:
+        (-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]):
+        (-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]):
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebVideoFullscreenInterfaceAVKit::cleanupFullscreen):
+
 2016-05-04  Chris Dumez  <cdumez@apple.com>
 
         Media elements should not be paused right away when removed from the document
index 2569317..8460699 100644 (file)
@@ -401,7 +401,10 @@ using namespace WebCore;
     if (option && self.audioMediaSelectionOptions)
         index = [self.audioMediaSelectionOptions indexOfObject:option];
 
-    self.delegate->selectAudioMediaOption(index != NSNotFound ? index : UINT64_MAX);
+    if (index == NSNotFound)
+        return;
+
+    self.delegate->selectAudioMediaOption(index);
 }
 
 - (WebAVMediaSelectionOption *)currentLegibleMediaSelectionOption
@@ -425,7 +428,10 @@ using namespace WebCore;
     if (option && self.legibleMediaSelectionOptions)
         index = [self.legibleMediaSelectionOptions indexOfObject:option];
 
-    self.delegate->selectLegibleMediaOption(index != NSNotFound ? index : UINT64_MAX);
+    if (index == NSNotFound)
+        return;
+
+    self.delegate->selectLegibleMediaOption(index);
 }
 
 - (BOOL)isPlayingOnExternalScreen
index 275fdd5..ff06ccb 100644 (file)
@@ -815,8 +815,6 @@ void WebVideoFullscreenInterfaceAVKit::cleanupFullscreen()
             [[getUIApplicationClass() sharedApplication] _setStatusBarOrientation:[m_parentWindow interfaceOrientation]];
     }
     
-    [playerController() setDelegate:nil];
-    
     [m_playerViewController setDelegate:nil];
     [m_playerViewController setPlayerController:nil];