Title: [216530] trunk/Source/WebCore
Revision
216530
Author
commit-qu...@webkit.org
Date
2017-05-09 11:42:47 -0700 (Tue, 09 May 2017)

Log Message

RealtimeOutgoingAudioSource is crashing when given data with more than two channels
https://bugs.webkit.org/show_bug.cgi?id=171868

Patch by Youenn Fablet <you...@apple.com> on 2017-05-09
Reviewed by Eric Carlson.

Manual testing.

* platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
(WebCore::libwebrtcAudioFormat): Capping the number of channels to 2.
(WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216529 => 216530)


--- trunk/Source/WebCore/ChangeLog	2017-05-09 18:34:27 UTC (rev 216529)
+++ trunk/Source/WebCore/ChangeLog	2017-05-09 18:42:47 UTC (rev 216530)
@@ -1,3 +1,16 @@
+2017-05-09  Youenn Fablet  <you...@apple.com>
+
+        RealtimeOutgoingAudioSource is crashing when given data with more than two channels
+        https://bugs.webkit.org/show_bug.cgi?id=171868
+
+        Reviewed by Eric Carlson.
+
+        Manual testing.
+
+        * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
+        (WebCore::libwebrtcAudioFormat): Capping the number of channels to 2.
+        (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
+
 2017-05-09  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         font-stretch: normal selects expanded fonts instead of condensed fonts

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp (216529 => 216530)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp	2017-05-09 18:34:27 UTC (rev 216529)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp	2017-05-09 18:42:47 UTC (rev 216530)
@@ -39,8 +39,10 @@
 
 static inline AudioStreamBasicDescription libwebrtcAudioFormat(Float64 sampleRate, size_t channelCount)
 {
+    // FIXME: Microphones can have more than two channels. In such case, we should do the mix down based on AudioChannelLayoutTag.
+    size_t libWebRTCChannelCount = channelCount >= 2 ? 2 : channelCount;
     AudioStreamBasicDescription streamFormat;
-    FillOutASBDForLPCM(streamFormat, sampleRate, channelCount, LibWebRTCAudioFormat::sampleSize, LibWebRTCAudioFormat::sampleSize, LibWebRTCAudioFormat::isFloat, LibWebRTCAudioFormat::isBigEndian, LibWebRTCAudioFormat::isNonInterleaved);
+    FillOutASBDForLPCM(streamFormat, sampleRate, libWebRTCChannelCount, LibWebRTCAudioFormat::sampleSize, LibWebRTCAudioFormat::sampleSize, LibWebRTCAudioFormat::isFloat, LibWebRTCAudioFormat::isBigEndian, LibWebRTCAudioFormat::isNonInterleaved);
     return streamFormat;
 }
 
@@ -78,8 +80,6 @@
 
 void RealtimeOutgoingAudioSource::audioSamplesAvailable(const MediaTime& time, const PlatformAudioData& audioData, const AudioStreamDescription& streamDescription, size_t sampleCount)
 {
-    ASSERT(streamDescription.numberOfChannels() <= 2);
-
     if (m_inputStreamDescription != streamDescription) {
         m_inputStreamDescription = toCAAudioStreamDescription(streamDescription);
         auto status  = m_sampleConverter->setInputFormat(m_inputStreamDescription);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to