Title: [285022] trunk/Source/WebCore
Revision
285022
Author
you...@apple.com
Date
2021-10-29 02:15:15 -0700 (Fri, 29 Oct 2021)

Log Message

AudioMediaStreamTrackRendererUnit::render should handle the case of failing to pull samples from the first source
https://bugs.webkit.org/show_bug.cgi?id=232429

Reviewed by Eric Carlson.

In case we fail to pull samples from the first source, we should copy the data of the second source,
and so on until we actually copy data. Then we can start mixing data.
In case all pulls fail, we now output silence.

* platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285021 => 285022)


--- trunk/Source/WebCore/ChangeLog	2021-10-29 09:13:24 UTC (rev 285021)
+++ trunk/Source/WebCore/ChangeLog	2021-10-29 09:15:15 UTC (rev 285022)
@@ -1,3 +1,16 @@
+2021-10-29  Youenn Fablet  <you...@apple.com>
+
+        AudioMediaStreamTrackRendererUnit::render should handle the case of failing to pull samples from the first source
+        https://bugs.webkit.org/show_bug.cgi?id=232429
+
+        Reviewed by Eric Carlson.
+
+        In case we fail to pull samples from the first source, we should copy the data of the second source,
+        and so on until we actually copy data. Then we can start mixing data.
+        In case all pulls fail, we now output silence.
+
+        * platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp:
+
 2021-10-29  Martin Robinson  <mrobin...@webkit.org>
 
         opacity should flatten when combined with transform-style: preserve-3d

Modified: trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp (285021 => 285022)


--- trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp	2021-10-29 09:13:24 UTC (rev 285021)
+++ trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp	2021-10-29 09:15:15 UTC (rev 285022)
@@ -176,18 +176,14 @@
 
     updateRenderSourcesIfNecessary();
 
-    if (m_renderSources.isEmpty()) {
-        actionFlags = kAudioUnitRenderAction_OutputIsSilence;
-        return;
-    }
-
     // Mix all sources.
-    bool isFirstSource = true;
+    bool hasCopiedData = false;
     for (auto& source : m_renderSources) {
-        source->pullSamples(ioData, sampleCount, sampleTime, hostTime, isFirstSource ? AudioSampleDataSource::Copy : AudioSampleDataSource::Mix);
-        isFirstSource = false;
+        if (source->pullSamples(ioData, sampleCount, sampleTime, hostTime, hasCopiedData ? AudioSampleDataSource::Mix : AudioSampleDataSource::Copy))
+            hasCopiedData = true;
     }
-    return;
+    if (!hasCopiedData)
+        actionFlags = kAudioUnitRenderAction_OutputIsSilence;
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to