Backed out changeset e282e41cd599 (bug 971528)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 24 Apr 2017 19:10:09 +0200
changeset 354560 f61b1bc0bee770b16ec3dac814ebd088d6044c5a
parent 354559 b815d628734daf2d1e9b1c3d635d6e81079c0272
child 354561 f5c43a9f8510ad50cf45248fe306707aa059b991
push id41367
push userarchaeopteryx@coole-files.de
push dateMon, 24 Apr 2017 17:12:01 +0000
treeherderautoland@f5c43a9f8510 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs971528
milestone55.0a1
backs oute282e41cd5997bb5e91340b863fcfaaad00597d8
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset e282e41cd599 (bug 971528)
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -595,53 +595,34 @@ MediaEngineWebRTCMicrophoneSource::Inser
     }
   }
 
   size_t len = mSources.Length();
   for (size_t i = 0; i < len; i++) {
     if (!mSources[i]) {
       continue;
     }
+    RefPtr<SharedBuffer> buffer =
+      SharedBuffer::Create(aFrames * aChannels * sizeof(T));
+    PodCopy(static_cast<T*>(buffer->Data()),
+            aBuffer, aFrames * aChannels);
 
     TimeStamp insertTime;
     // Make sure we include the stream and the track.
     // The 0:1 is a flag to note when we've done the final insert for a given input block.
     LogTime(AsyncLatencyLogger::AudioTrackInsertion,
             LATENCY_STREAM_ID(mSources[i].get(), mTrackID),
             (i+1 < len) ? 0 : 1, insertTime);
 
-    // Bug 971528 - Support stereo capture in gUM
-    MOZ_ASSERT(aChannels == 1 || aChannels == 2,
-        "GraphDriver only supports mono and stereo audio for now");
-
     nsAutoPtr<AudioSegment> segment(new AudioSegment());
-    RefPtr<SharedBuffer> buffer =
-      SharedBuffer::Create(aFrames * aChannels * sizeof(T));
-    AutoTArray<const T*, 8> channels;
-    channels.SetLength(aChannels);
-    if (aChannels == 1) {
-      PodCopy(static_cast<T*>(buffer->Data()), aBuffer, aFrames);
-      channels.AppendElement(static_cast<T*>(buffer->Data()));
-    } else {
-      AutoTArray<T*, 8> write_channels;
-      write_channels.SetLength(aChannels);
-      T * samples = static_cast<T*>(buffer->Data());
-
-      size_t offset = 0;
-      for(uint32_t i = 0; i < aChannels; ++i) {
-        channels[i] = write_channels[i] = samples + offset;
-        offset += aFrames;
-      }
-
-      DeinterleaveAndConvertBuffer(aBuffer,
-                                   aFrames,
-                                   aChannels,
-                                   write_channels.Elements());
-    }
-
+    AutoTArray<const T*, 1> channels;
+    // XXX Bug 971528 - Support stereo capture in gUM
+    MOZ_ASSERT(aChannels == 1,
+        "GraphDriver only supports us stereo audio for now");
+    channels.AppendElement(static_cast<T*>(buffer->Data()));
     segment->AppendFrames(buffer.forget(), channels, aFrames,
                          mPrincipalHandles[i]);
     segment->GetStartTime(insertTime);
 
     mSources[i]->AppendToTrack(mTrackID, segment);
   }
 }