Bug 901633 - Part 9 - Make the necessary changes to VoEExternalMediaImpl::ExternalRecordingInsertData so that it the number of channels is forwarded down the webrtc.org code. r=jesup
authorPaul Adenot <paul@paul.cx>
Tue, 11 Aug 2015 13:49:29 +0200
changeset 260331 142737374b1c9f955981bba3e2c2b00d0d026558
parent 260330 4547ae1e73ee9df217c1b8c007820bf4fb1bf792
child 260332 f7cbf699f687563b56f18eb0ee94901c3039ca2e
push id29307
push userryanvm@gmail.com
push dateWed, 02 Sep 2015 01:01:53 +0000
treeherdermozilla-central@e2eb0442ece9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs901633
milestone43.0a1
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
Bug 901633 - Part 9 - Make the necessary changes to VoEExternalMediaImpl::ExternalRecordingInsertData so that it the number of channels is forwarded down the webrtc.org code. r=jesup
media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.cc
--- a/media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.cc
+++ b/media/webrtc/trunk/webrtc/voice_engine/voe_external_media_impl.cc
@@ -209,17 +209,20 @@ int VoEExternalMediaImpl::ExternalRecord
     if (current_delay_ms < 0)
     {
         shared_->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
             "SetExternalRecordingStatus() invalid delay)");
         return -1;
     }
 
     uint16_t blockSize = samplingFreqHz / 100;
-    uint32_t nBlocks = lengthSamples / blockSize;
+    // We know the number of samples for 10ms of audio, so we can derive the
+    // number of channels here:
+    uint32_t channels = lengthSamples * 100 / samplingFreqHz;
+    uint32_t nBlocks = lengthSamples / blockSize / channels;
     int16_t totalDelayMS = 0;
     uint16_t playoutDelayMS = 0;
 
     for (uint32_t i = 0; i < nBlocks; i++)
     {
         if (!shared_->ext_playout())
         {
             // Use real playout delay if external playout is not enabled.
@@ -237,17 +240,17 @@ int VoEExternalMediaImpl::ExternalRecord
             // Compensate for block sizes larger than 10ms
             totalDelayMS -= (int16_t)(i*10);
             if (totalDelayMS < 0)
                 totalDelayMS = 0;
         }
         shared_->transmit_mixer()->PrepareDemux(
             (const int8_t*)(&speechData10ms[i*blockSize]),
             blockSize,
-            1,
+            channels,
             samplingFreqHz,
             totalDelayMS,
             0,
             0,
             false); // Typing detection not supported
 
         shared_->transmit_mixer()->DemuxAndMix();
         shared_->transmit_mixer()->EncodeAndSend();