Title: [275896] trunk/Source/WebCore
Revision
275896
Author
[email protected]
Date
2021-04-13 11:31:14 -0700 (Tue, 13 Apr 2021)

Log Message

AudioSourceProviderAVFObjC::setClient should check for m_avAssetTrack
https://bugs.webkit.org/show_bug.cgi?id=224478

Patch by Kimmo Kinnunen <[email protected]> on 2021-04-13
Reviewed by Eric Carlson.

Check for m_avAssetTrack when setting the client.
This is done for consistency, it is unclear if this affects
real world content.

* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::setClient):
(WebCore::AudioSourceProviderAVFObjC::setPlayerItem):
(WebCore::AudioSourceProviderAVFObjC::setAudioTrack):
(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
(WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275895 => 275896)


--- trunk/Source/WebCore/ChangeLog	2021-04-13 18:29:16 UTC (rev 275895)
+++ trunk/Source/WebCore/ChangeLog	2021-04-13 18:31:14 UTC (rev 275896)
@@ -1,3 +1,22 @@
+2021-04-13  Kimmo Kinnunen  <[email protected]>
+
+        AudioSourceProviderAVFObjC::setClient should check for m_avAssetTrack
+        https://bugs.webkit.org/show_bug.cgi?id=224478
+
+        Reviewed by Eric Carlson.
+
+        Check for m_avAssetTrack when setting the client.
+        This is done for consistency, it is unclear if this affects
+        real world content.
+
+        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
+        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
+        (WebCore::AudioSourceProviderAVFObjC::setClient):
+        (WebCore::AudioSourceProviderAVFObjC::setPlayerItem):
+        (WebCore::AudioSourceProviderAVFObjC::setAudioTrack):
+        (WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
+        (WebCore::AudioSourceProviderAVFObjC::createMixIfNeeded):
+
 2021-04-13  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r275889.

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h (275895 => 275896)


--- trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h	2021-04-13 18:29:16 UTC (rev 275895)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h	2021-04-13 18:31:14 UTC (rev 275896)
@@ -69,8 +69,8 @@
 private:
     AudioSourceProviderAVFObjC(AVPlayerItem *);
 
-    void destroyMix();
-    void createMix();
+    void destroyMixIfNeeded();
+    void createMixIfNeeded();
 
     // AudioSourceProvider
     void provideInput(AudioBus*, size_t framesToProcess) override;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm (275895 => 275896)


--- trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm	2021-04-13 18:29:16 UTC (rev 275895)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm	2021-04-13 18:31:14 UTC (rev 275896)
@@ -158,14 +158,9 @@
 {
     if (m_client == client)
         return;
-
-    if (m_avAudioMix)
-        destroyMix();
-
+    destroyMixIfNeeded();
     m_client = client;
-
-    if (m_client && m_avPlayerItem)
-        createMix();
+    createMixIfNeeded();
 }
 
 void AudioSourceProviderAVFObjC::setPlayerItem(AVPlayerItem *avPlayerItem)
@@ -172,14 +167,9 @@
 {
     if (m_avPlayerItem == avPlayerItem)
         return;
-
-    if (m_avAudioMix)
-        destroyMix();
-
+    destroyMixIfNeeded();
     m_avPlayerItem = avPlayerItem;
-
-    if (m_client && m_avPlayerItem && m_avAssetTrack)
-        createMix();
+    createMixIfNeeded();
 }
 
 void AudioSourceProviderAVFObjC::setAudioTrack(AVAssetTrack *avAssetTrack)
@@ -186,18 +176,16 @@
 {
     if (m_avAssetTrack == avAssetTrack)
         return;
-
-    if (m_avAudioMix)
-        destroyMix();
-
+    destroyMixIfNeeded();
     m_avAssetTrack = avAssetTrack;
-
-    if (m_client && m_avPlayerItem && m_avAssetTrack)
-        createMix();
+    createMixIfNeeded();
 }
 
-void AudioSourceProviderAVFObjC::destroyMix()
+void AudioSourceProviderAVFObjC::destroyMixIfNeeded()
 {
+    if (!m_avAudioMix)
+        return;
+
     if (m_avPlayerItem)
         [m_avPlayerItem setAudioMix:nil];
     [m_avAudioMix setInputParameters:@[ ]];
@@ -205,11 +193,12 @@
     m_tap.clear();
 }
 
-void AudioSourceProviderAVFObjC::createMix()
+void AudioSourceProviderAVFObjC::createMixIfNeeded()
 {
+    if (!m_client || !m_avPlayerItem || !m_avAssetTrack)
+        return;
+
     ASSERT(!m_avAudioMix);
-    ASSERT(m_avPlayerItem);
-    ASSERT(m_client);
 
     m_avAudioMix = adoptNS([PAL::allocAVMutableAudioMixInstance() init]);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to