2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-05-02 23:56:37 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-05-28 08:11:59 +00:00
|
|
|
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-20 14:39:39 -07:00
|
|
|
#include "webrtc/common_audio/include/audio_util.h"
|
2014-04-22 21:00:04 +00:00
|
|
|
#include "webrtc/common_audio/resampler/push_sinc_resampler.h"
|
2013-05-28 08:11:59 +00:00
|
|
|
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
2015-01-28 19:57:00 +00:00
|
|
|
#include "webrtc/common_audio/channel_buffer.h"
|
2014-11-27 23:40:25 +00:00
|
|
|
#include "webrtc/modules/audio_processing/common.h"
|
2011-11-15 16:57:56 +00:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
namespace {
|
|
|
|
|
|
Reformat existing code. There should be no functional effects.
This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)
BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org
Review URL: https://codereview.webrtc.org/1172163004
Cr-Commit-Position: refs/heads/master@{#9420}
2015-06-11 14:31:38 -07:00
|
|
|
const int kSamplesPer16kHzChannel = 160;
|
|
|
|
|
const int kSamplesPer32kHzChannel = 320;
|
|
|
|
|
const int kSamplesPer48kHzChannel = 480;
|
2015-04-27 11:34:45 -07:00
|
|
|
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
bool HasKeyboardChannel(AudioProcessing::ChannelLayout layout) {
|
|
|
|
|
switch (layout) {
|
|
|
|
|
case AudioProcessing::kMono:
|
|
|
|
|
case AudioProcessing::kStereo:
|
|
|
|
|
return false;
|
|
|
|
|
case AudioProcessing::kMonoAndKeyboard:
|
|
|
|
|
case AudioProcessing::kStereoAndKeyboard:
|
|
|
|
|
return true;
|
2014-04-24 18:28:56 +00:00
|
|
|
}
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
assert(false);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int KeyboardChannelIndex(AudioProcessing::ChannelLayout layout) {
|
|
|
|
|
switch (layout) {
|
|
|
|
|
case AudioProcessing::kMono:
|
|
|
|
|
case AudioProcessing::kStereo:
|
|
|
|
|
assert(false);
|
|
|
|
|
return -1;
|
|
|
|
|
case AudioProcessing::kMonoAndKeyboard:
|
|
|
|
|
return 1;
|
|
|
|
|
case AudioProcessing::kStereoAndKeyboard:
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
assert(false);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2014-04-24 18:28:56 +00:00
|
|
|
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
template <typename T>
|
|
|
|
|
void StereoToMono(const T* left, const T* right, T* out,
|
|
|
|
|
int num_frames) {
|
|
|
|
|
for (int i = 0; i < num_frames; ++i)
|
|
|
|
|
out[i] = (left[i] + right[i]) / 2;
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
int NumBandsFromSamplesPerChannel(int num_frames) {
|
|
|
|
|
int num_bands = 1;
|
|
|
|
|
if (num_frames == kSamplesPer32kHzChannel ||
|
|
|
|
|
num_frames == kSamplesPer48kHzChannel) {
|
|
|
|
|
num_bands = rtc::CheckedDivExact(num_frames,
|
|
|
|
|
static_cast<int>(kSamplesPer16kHzChannel));
|
|
|
|
|
}
|
|
|
|
|
return num_bands;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-22 21:00:04 +00:00
|
|
|
} // namespace
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
AudioBuffer::AudioBuffer(int input_num_frames,
|
2014-04-22 21:00:04 +00:00
|
|
|
int num_input_channels,
|
2015-02-10 22:52:15 +00:00
|
|
|
int process_num_frames,
|
2014-04-22 21:00:04 +00:00
|
|
|
int num_process_channels,
|
2015-02-10 22:52:15 +00:00
|
|
|
int output_num_frames)
|
|
|
|
|
: input_num_frames_(input_num_frames),
|
2014-04-22 21:00:04 +00:00
|
|
|
num_input_channels_(num_input_channels),
|
2015-02-10 22:52:15 +00:00
|
|
|
proc_num_frames_(process_num_frames),
|
2014-04-22 21:00:04 +00:00
|
|
|
num_proc_channels_(num_process_channels),
|
2015-02-10 22:52:15 +00:00
|
|
|
output_num_frames_(output_num_frames),
|
2014-12-11 17:09:21 +00:00
|
|
|
num_channels_(num_process_channels),
|
2015-02-10 22:52:15 +00:00
|
|
|
num_bands_(NumBandsFromSamplesPerChannel(proc_num_frames_)),
|
Reformat existing code. There should be no functional effects.
This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)
BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org
Review URL: https://codereview.webrtc.org/1172163004
Cr-Commit-Position: refs/heads/master@{#9420}
2015-06-11 14:31:38 -07:00
|
|
|
num_split_frames_(rtc::CheckedDivExact(proc_num_frames_, num_bands_)),
|
2014-07-17 08:27:39 +00:00
|
|
|
mixed_low_pass_valid_(false),
|
2011-09-19 15:28:51 +00:00
|
|
|
reference_copied_(false),
|
|
|
|
|
activity_(AudioFrame::kVadUnknown),
|
2014-04-24 18:28:56 +00:00
|
|
|
keyboard_data_(NULL),
|
2015-02-10 22:52:15 +00:00
|
|
|
data_(new IFChannelBuffer(proc_num_frames_, num_proc_channels_)) {
|
|
|
|
|
assert(input_num_frames_ > 0);
|
|
|
|
|
assert(proc_num_frames_ > 0);
|
|
|
|
|
assert(output_num_frames_ > 0);
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
assert(num_input_channels_ > 0 && num_input_channels_ <= 2);
|
2015-02-10 22:52:15 +00:00
|
|
|
assert(num_proc_channels_ > 0 && num_proc_channels_ <= num_input_channels_);
|
2014-04-22 21:00:04 +00:00
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
if (input_num_frames_ != proc_num_frames_ ||
|
|
|
|
|
output_num_frames_ != proc_num_frames_) {
|
2014-04-22 21:00:04 +00:00
|
|
|
// Create an intermediate buffer for resampling.
|
2015-02-10 22:52:15 +00:00
|
|
|
process_buffer_.reset(new ChannelBuffer<float>(proc_num_frames_,
|
2014-04-22 21:00:04 +00:00
|
|
|
num_proc_channels_));
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
if (input_num_frames_ != proc_num_frames_) {
|
|
|
|
|
for (int i = 0; i < num_proc_channels_; ++i) {
|
|
|
|
|
input_resamplers_.push_back(
|
|
|
|
|
new PushSincResampler(input_num_frames_,
|
|
|
|
|
proc_num_frames_));
|
|
|
|
|
}
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
if (output_num_frames_ != proc_num_frames_) {
|
|
|
|
|
for (int i = 0; i < num_proc_channels_; ++i) {
|
|
|
|
|
output_resamplers_.push_back(
|
|
|
|
|
new PushSincResampler(proc_num_frames_,
|
|
|
|
|
output_num_frames_));
|
|
|
|
|
}
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
if (num_bands_ > 1) {
|
|
|
|
|
split_data_.reset(new IFChannelBuffer(proc_num_frames_,
|
|
|
|
|
num_proc_channels_,
|
|
|
|
|
num_bands_));
|
2015-04-27 11:34:45 -07:00
|
|
|
splitting_filter_.reset(new SplittingFilter(num_proc_channels_,
|
|
|
|
|
num_bands_,
|
|
|
|
|
proc_num_frames_));
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-24 18:28:56 +00:00
|
|
|
AudioBuffer::~AudioBuffer() {}
|
|
|
|
|
|
2014-04-22 21:00:04 +00:00
|
|
|
void AudioBuffer::CopyFrom(const float* const* data,
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
int num_frames,
|
|
|
|
|
AudioProcessing::ChannelLayout layout) {
|
|
|
|
|
assert(num_frames == input_num_frames_);
|
|
|
|
|
assert(ChannelsFromLayout(layout) == num_input_channels_);
|
2014-04-22 21:00:04 +00:00
|
|
|
InitForNewData();
|
2015-05-20 14:39:39 -07:00
|
|
|
// Initialized lazily because there's a different condition in
|
|
|
|
|
// DeinterleaveFrom.
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
if ((num_input_channels_ == 2 && num_proc_channels_ == 1) && !input_buffer_) {
|
2015-05-20 14:39:39 -07:00
|
|
|
input_buffer_.reset(
|
|
|
|
|
new IFChannelBuffer(input_num_frames_, num_proc_channels_));
|
|
|
|
|
}
|
2014-04-22 21:00:04 +00:00
|
|
|
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
if (HasKeyboardChannel(layout)) {
|
|
|
|
|
keyboard_data_ = data[KeyboardChannelIndex(layout)];
|
2014-04-24 18:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-22 21:00:04 +00:00
|
|
|
// Downmix.
|
|
|
|
|
const float* const* data_ptr = data;
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
if (num_input_channels_ == 2 && num_proc_channels_ == 1) {
|
|
|
|
|
StereoToMono(data[0],
|
|
|
|
|
data[1],
|
|
|
|
|
input_buffer_->fbuf()->channels()[0],
|
|
|
|
|
input_num_frames_);
|
2015-05-20 14:39:39 -07:00
|
|
|
data_ptr = input_buffer_->fbuf_const()->channels();
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resample.
|
2015-02-10 22:52:15 +00:00
|
|
|
if (input_num_frames_ != proc_num_frames_) {
|
2014-04-22 21:00:04 +00:00
|
|
|
for (int i = 0; i < num_proc_channels_; ++i) {
|
|
|
|
|
input_resamplers_[i]->Resample(data_ptr[i],
|
2015-02-10 22:52:15 +00:00
|
|
|
input_num_frames_,
|
|
|
|
|
process_buffer_->channels()[i],
|
|
|
|
|
proc_num_frames_);
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
data_ptr = process_buffer_->channels();
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 04:58:14 +00:00
|
|
|
// Convert to the S16 range.
|
2014-04-22 21:00:04 +00:00
|
|
|
for (int i = 0; i < num_proc_channels_; ++i) {
|
2015-02-10 22:52:15 +00:00
|
|
|
FloatToFloatS16(data_ptr[i],
|
|
|
|
|
proc_num_frames_,
|
|
|
|
|
data_->fbuf()->channels()[i]);
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
void AudioBuffer::CopyTo(int num_frames,
|
|
|
|
|
AudioProcessing::ChannelLayout layout,
|
2014-04-22 21:00:04 +00:00
|
|
|
float* const* data) {
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
assert(num_frames == output_num_frames_);
|
|
|
|
|
assert(ChannelsFromLayout(layout) == num_channels_);
|
2014-04-22 21:00:04 +00:00
|
|
|
|
2014-10-31 04:58:14 +00:00
|
|
|
// Convert to the float range.
|
2014-04-22 21:00:04 +00:00
|
|
|
float* const* data_ptr = data;
|
2015-02-10 22:52:15 +00:00
|
|
|
if (output_num_frames_ != proc_num_frames_) {
|
2014-04-22 21:00:04 +00:00
|
|
|
// Convert to an intermediate buffer for subsequent resampling.
|
|
|
|
|
data_ptr = process_buffer_->channels();
|
|
|
|
|
}
|
2014-12-11 17:09:21 +00:00
|
|
|
for (int i = 0; i < num_channels_; ++i) {
|
2015-02-10 22:52:15 +00:00
|
|
|
FloatS16ToFloat(data_->fbuf()->channels()[i],
|
|
|
|
|
proc_num_frames_,
|
2014-10-31 04:58:14 +00:00
|
|
|
data_ptr[i]);
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resample.
|
2015-02-10 22:52:15 +00:00
|
|
|
if (output_num_frames_ != proc_num_frames_) {
|
2014-12-11 17:09:21 +00:00
|
|
|
for (int i = 0; i < num_channels_; ++i) {
|
2014-04-22 21:00:04 +00:00
|
|
|
output_resamplers_[i]->Resample(data_ptr[i],
|
2015-02-10 22:52:15 +00:00
|
|
|
proc_num_frames_,
|
2014-04-22 21:00:04 +00:00
|
|
|
data[i],
|
2015-02-10 22:52:15 +00:00
|
|
|
output_num_frames_);
|
2014-04-22 21:00:04 +00:00
|
|
|
}
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-22 21:00:04 +00:00
|
|
|
void AudioBuffer::InitForNewData() {
|
2014-04-24 18:28:56 +00:00
|
|
|
keyboard_data_ = NULL;
|
2014-07-17 08:27:39 +00:00
|
|
|
mixed_low_pass_valid_ = false;
|
2014-03-04 20:58:13 +00:00
|
|
|
reference_copied_ = false;
|
|
|
|
|
activity_ = AudioFrame::kVadUnknown;
|
2014-12-11 17:09:21 +00:00
|
|
|
num_channels_ = num_proc_channels_;
|
2014-03-04 20:58:13 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
const int16_t* const* AudioBuffer::channels_const() const {
|
2015-02-10 22:52:15 +00:00
|
|
|
return data_->ibuf_const()->channels();
|
2014-11-14 22:18:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int16_t* const* AudioBuffer::channels() {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
2015-02-10 22:52:15 +00:00
|
|
|
return data_->ibuf()->channels();
|
2014-11-14 22:18:10 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-10 19:30:57 +00:00
|
|
|
const int16_t* const* AudioBuffer::split_bands_const(int channel) const {
|
2015-02-10 22:52:15 +00:00
|
|
|
return split_data_.get() ?
|
|
|
|
|
split_data_->ibuf_const()->bands(channel) :
|
|
|
|
|
data_->ibuf_const()->bands(channel);
|
2014-05-15 11:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-10 19:30:57 +00:00
|
|
|
int16_t* const* AudioBuffer::split_bands(int channel) {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
2015-02-10 22:52:15 +00:00
|
|
|
return split_data_.get() ?
|
|
|
|
|
split_data_->ibuf()->bands(channel) :
|
|
|
|
|
data_->ibuf()->bands(channel);
|
2014-07-03 09:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
const int16_t* const* AudioBuffer::split_channels_const(Band band) const {
|
2015-02-10 22:52:15 +00:00
|
|
|
if (split_data_.get()) {
|
|
|
|
|
return split_data_->ibuf_const()->channels(band);
|
2014-12-03 01:06:35 +00:00
|
|
|
} else {
|
2015-02-10 22:52:15 +00:00
|
|
|
return band == kBand0To8kHz ? data_->ibuf_const()->channels() : nullptr;
|
2014-12-03 01:06:35 +00:00
|
|
|
}
|
2014-09-25 20:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
int16_t* const* AudioBuffer::split_channels(Band band) {
|
2014-09-25 20:52:08 +00:00
|
|
|
mixed_low_pass_valid_ = false;
|
2015-02-10 22:52:15 +00:00
|
|
|
if (split_data_.get()) {
|
|
|
|
|
return split_data_->ibuf()->channels(band);
|
2014-12-03 01:06:35 +00:00
|
|
|
} else {
|
2015-02-10 22:52:15 +00:00
|
|
|
return band == kBand0To8kHz ? data_->ibuf()->channels() : nullptr;
|
2014-12-03 01:06:35 +00:00
|
|
|
}
|
2014-09-25 20:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-26 21:52:20 +00:00
|
|
|
ChannelBuffer<int16_t>* AudioBuffer::data() {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
|
|
|
|
return data_->ibuf();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ChannelBuffer<int16_t>* AudioBuffer::data() const {
|
|
|
|
|
return data_->ibuf_const();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ChannelBuffer<int16_t>* AudioBuffer::split_data() {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
|
|
|
|
return split_data_.get() ? split_data_->ibuf() : data_->ibuf();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ChannelBuffer<int16_t>* AudioBuffer::split_data() const {
|
|
|
|
|
return split_data_.get() ? split_data_->ibuf_const() : data_->ibuf_const();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
const float* const* AudioBuffer::channels_const_f() const {
|
2015-02-10 22:52:15 +00:00
|
|
|
return data_->fbuf_const()->channels();
|
2014-11-14 22:18:10 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
float* const* AudioBuffer::channels_f() {
|
2014-11-14 22:18:10 +00:00
|
|
|
mixed_low_pass_valid_ = false;
|
2015-02-10 22:52:15 +00:00
|
|
|
return data_->fbuf()->channels();
|
2014-11-14 22:18:10 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-10 19:30:57 +00:00
|
|
|
const float* const* AudioBuffer::split_bands_const_f(int channel) const {
|
2015-02-10 22:52:15 +00:00
|
|
|
return split_data_.get() ?
|
|
|
|
|
split_data_->fbuf_const()->bands(channel) :
|
|
|
|
|
data_->fbuf_const()->bands(channel);
|
2014-05-15 11:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-10 19:30:57 +00:00
|
|
|
float* const* AudioBuffer::split_bands_f(int channel) {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
2015-02-10 22:52:15 +00:00
|
|
|
return split_data_.get() ?
|
|
|
|
|
split_data_->fbuf()->bands(channel) :
|
|
|
|
|
data_->fbuf()->bands(channel);
|
2014-07-03 09:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
const float* const* AudioBuffer::split_channels_const_f(Band band) const {
|
2015-02-10 22:52:15 +00:00
|
|
|
if (split_data_.get()) {
|
|
|
|
|
return split_data_->fbuf_const()->channels(band);
|
2014-12-03 01:06:35 +00:00
|
|
|
} else {
|
2015-02-10 22:52:15 +00:00
|
|
|
return band == kBand0To8kHz ? data_->fbuf_const()->channels() : nullptr;
|
2014-12-03 01:06:35 +00:00
|
|
|
}
|
2014-09-25 20:52:08 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-03 01:06:35 +00:00
|
|
|
float* const* AudioBuffer::split_channels_f(Band band) {
|
2014-09-25 20:52:08 +00:00
|
|
|
mixed_low_pass_valid_ = false;
|
2015-02-10 22:52:15 +00:00
|
|
|
if (split_data_.get()) {
|
|
|
|
|
return split_data_->fbuf()->channels(band);
|
2014-12-03 01:06:35 +00:00
|
|
|
} else {
|
2015-02-10 22:52:15 +00:00
|
|
|
return band == kBand0To8kHz ? data_->fbuf()->channels() : nullptr;
|
2014-12-03 01:06:35 +00:00
|
|
|
}
|
2014-11-17 23:01:23 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-26 21:52:20 +00:00
|
|
|
ChannelBuffer<float>* AudioBuffer::data_f() {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
|
|
|
|
return data_->fbuf();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ChannelBuffer<float>* AudioBuffer::data_f() const {
|
|
|
|
|
return data_->fbuf_const();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ChannelBuffer<float>* AudioBuffer::split_data_f() {
|
|
|
|
|
mixed_low_pass_valid_ = false;
|
|
|
|
|
return split_data_.get() ? split_data_->fbuf() : data_->fbuf();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ChannelBuffer<float>* AudioBuffer::split_data_f() const {
|
|
|
|
|
return split_data_.get() ? split_data_->fbuf_const() : data_->fbuf_const();
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-17 08:27:39 +00:00
|
|
|
const int16_t* AudioBuffer::mixed_low_pass_data() {
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
// Currently only mixing stereo to mono is supported.
|
|
|
|
|
assert(num_proc_channels_ == 1 || num_proc_channels_ == 2);
|
|
|
|
|
|
2014-07-17 08:27:39 +00:00
|
|
|
if (num_proc_channels_ == 1) {
|
2014-12-10 19:30:57 +00:00
|
|
|
return split_bands_const(0)[kBand0To8kHz];
|
2014-07-17 08:27:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mixed_low_pass_valid_) {
|
|
|
|
|
if (!mixed_low_pass_channels_.get()) {
|
|
|
|
|
mixed_low_pass_channels_.reset(
|
2015-02-10 22:52:15 +00:00
|
|
|
new ChannelBuffer<int16_t>(num_split_frames_, 1));
|
2014-07-17 08:27:39 +00:00
|
|
|
}
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
StereoToMono(split_bands_const(0)[kBand0To8kHz],
|
|
|
|
|
split_bands_const(1)[kBand0To8kHz],
|
|
|
|
|
mixed_low_pass_channels_->channels()[0],
|
|
|
|
|
num_split_frames_);
|
2014-07-17 08:27:39 +00:00
|
|
|
mixed_low_pass_valid_ = true;
|
|
|
|
|
}
|
2015-02-10 22:52:15 +00:00
|
|
|
return mixed_low_pass_channels_->channels()[0];
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-30 16:44:13 +00:00
|
|
|
const int16_t* AudioBuffer::low_pass_reference(int channel) const {
|
2011-07-07 08:21:25 +00:00
|
|
|
if (!reference_copied_) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
return low_pass_reference_channels_->channels()[channel];
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-24 18:28:56 +00:00
|
|
|
const float* AudioBuffer::keyboard_data() const {
|
|
|
|
|
return keyboard_data_;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-19 15:28:51 +00:00
|
|
|
void AudioBuffer::set_activity(AudioFrame::VADActivity activity) {
|
|
|
|
|
activity_ = activity;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-15 16:57:56 +00:00
|
|
|
AudioFrame::VADActivity AudioBuffer::activity() const {
|
2011-09-19 15:28:51 +00:00
|
|
|
return activity_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AudioBuffer::num_channels() const {
|
2014-12-11 17:09:21 +00:00
|
|
|
return num_channels_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AudioBuffer::set_num_channels(int num_channels) {
|
|
|
|
|
num_channels_ = num_channels;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
int AudioBuffer::num_frames() const {
|
|
|
|
|
return proc_num_frames_;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
int AudioBuffer::num_frames_per_band() const {
|
|
|
|
|
return num_split_frames_;
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-10 22:52:15 +00:00
|
|
|
int AudioBuffer::num_keyboard_frames() const {
|
2014-04-24 18:28:56 +00:00
|
|
|
// We don't resample the keyboard channel.
|
2015-02-10 22:52:15 +00:00
|
|
|
return input_num_frames_;
|
2014-04-24 18:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-10 19:30:57 +00:00
|
|
|
int AudioBuffer::num_bands() const {
|
|
|
|
|
return num_bands_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-20 14:39:39 -07:00
|
|
|
// The resampler is only for supporting 48kHz to 16kHz in the reverse stream.
|
2011-09-19 15:28:51 +00:00
|
|
|
void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) {
|
Enable render downmixing to mono in AudioProcessing.
In practice, we have been doing this since time immemorial, but have
relied on the user to do the downmixing (first voice engine then
Chromium). It's more logical for this burden to fall on AudioProcessing,
however, who can be expected to know that this is a reasonable approach
for AEC. Permitting two render channels results in running two AECs
serially.
Critically, in my recent change to have Chromium adopt the float
interface:
https://codereview.chromium.org/420603004
I removed the downmixing by Chromium, forgetting that we hadn't yet
enabled this feature in AudioProcessing. This corrects that oversight.
The change in paths hit by production users is very minor. As commented
it required adding downmixing to the int16_t path to satisfy
bit-exactness tests.
For reference, find the ApmTest.Process errors here:
https://paste.googleplex.com/6372007910309888
BUG=webrtc:3853
TESTED=listened to the files output from the Process test, and verified
that they sound as expected: higher echo while the AEC is adapting, but
afterwards very close.
R=aluebs@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/31459004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7292 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-24 20:06:23 +00:00
|
|
|
assert(frame->num_channels_ == num_input_channels_);
|
Reformat existing code. There should be no functional effects.
This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)
BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org
Review URL: https://codereview.webrtc.org/1172163004
Cr-Commit-Position: refs/heads/master@{#9420}
2015-06-11 14:31:38 -07:00
|
|
|
assert(frame->samples_per_channel_ == input_num_frames_);
|
2014-04-22 21:00:04 +00:00
|
|
|
InitForNewData();
|
2015-05-20 14:39:39 -07:00
|
|
|
// Initialized lazily because there's a different condition in CopyFrom.
|
|
|
|
|
if ((input_num_frames_ != proc_num_frames_) && !input_buffer_) {
|
|
|
|
|
input_buffer_.reset(
|
|
|
|
|
new IFChannelBuffer(input_num_frames_, num_proc_channels_));
|
|
|
|
|
}
|
2012-05-02 23:56:37 +00:00
|
|
|
activity_ = frame->vad_activity_;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-05-20 14:39:39 -07:00
|
|
|
int16_t* const* deinterleaved;
|
|
|
|
|
if (input_num_frames_ == proc_num_frames_) {
|
|
|
|
|
deinterleaved = data_->ibuf()->channels();
|
|
|
|
|
} else {
|
|
|
|
|
deinterleaved = input_buffer_->ibuf()->channels();
|
|
|
|
|
}
|
Revert of Allow more than 2 input channels in AudioProcessing. (patchset #13 id:240001 of https://codereview.webrtc.org/1226093007/)
Reason for revert:
Breaks Chromium FYI content_browsertest on all platforms. The testcase that fails is WebRtcAecDumpBrowserTest.CallWithAecDump.
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux/builds/19388
Sample output:
[ RUN ] WebRtcAecDumpBrowserTest.CallWithAecDump
Xlib: extension "RANDR" missing on display ":9".
[4:14:0722/211548:1282124453:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: ISAC/48000/1 (105)
[4:14:0722/211548:1282124593:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMU/8000/2 (110)
[4:14:0722/211548:1282124700:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: PCMA/8000/2 (118)
[4:14:0722/211548:1282124815:WARNING:webrtcvoiceengine.cc(472)] Unexpected codec: G722/8000/2 (119)
[19745:19745:0722/211548:1282133667:INFO:CONSOLE(64)] "Looking at video in element remote-view-1", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
[19745:19745:0722/211548:1282136892:INFO:CONSOLE(64)] "Looking at video in element remote-view-2", source: http://127.0.0.1:48819/media/webrtc_test_utilities.js (64)
../../content/test/webrtc_content_browsertest_base.cc:62: Failure
Value of: ExecuteScriptAndExtractString( shell()->web_contents(), javascript, &result)
Actual: false
Expected: true
Failed to execute javascript call({video: true, audio: true});.
From javascript: (nothing)
When executing 'call({video: true, audio: true});'
../../content/test/webrtc_content_browsertest_base.cc:75: Failure
Failed
../../content/browser/media/webrtc_aecdump_browsertest.cc:26: Failure
Expected: (base::kNullProcessId) != (*id), actual: 0 vs 0
../../content/browser/media/webrtc_aecdump_browsertest.cc:95: Failure
Value of: GetRenderProcessHostId(&render_process_id)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:99: Failure
Value of: base::PathExists(dump_file)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:101: Failure
Value of: base::GetFileSize(dump_file, &file_size)
Actual: false
Expected: true
../../content/browser/media/webrtc_aecdump_browsertest.cc:102: Failure
Expected: (file_size) > (0), actual: 0 vs 0
[ FAILED ] WebRtcAecDumpBrowserTest.CallWithAecDump, where TypeParam = and GetParam() = (361 ms)
Original issue's description:
> Allow more than 2 input channels in AudioProcessing.
>
> The number of output channels is constrained to be equal to either 1 or the
> number of input channels.
>
> R=aluebs@webrtc.org, andrew@webrtc.org, pbos@webrtc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/c204754b7a0cc801c70e8ce6c689f57f6ce00b3b
TBR=andrew@webrtc.org,aluebs@webrtc.org,ajm@chromium.org,pbos@chromium.org,pbos@webrtc.org,mgraczyk@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.webrtc.org/1253573005
Cr-Commit-Position: refs/heads/master@{#9621}
2015-07-23 04:30:06 -07:00
|
|
|
if (num_input_channels_ == 2 && num_proc_channels_ == 1) {
|
|
|
|
|
// Downmix directly; no explicit deinterleaving needed.
|
|
|
|
|
for (int i = 0; i < input_num_frames_; ++i) {
|
|
|
|
|
deinterleaved[0][i] = (frame->data_[i * 2] + frame->data_[i * 2 + 1]) / 2;
|
|
|
|
|
}
|
Enable render downmixing to mono in AudioProcessing.
In practice, we have been doing this since time immemorial, but have
relied on the user to do the downmixing (first voice engine then
Chromium). It's more logical for this burden to fall on AudioProcessing,
however, who can be expected to know that this is a reasonable approach
for AEC. Permitting two render channels results in running two AECs
serially.
Critically, in my recent change to have Chromium adopt the float
interface:
https://codereview.chromium.org/420603004
I removed the downmixing by Chromium, forgetting that we hadn't yet
enabled this feature in AudioProcessing. This corrects that oversight.
The change in paths hit by production users is very minor. As commented
it required adding downmixing to the int16_t path to satisfy
bit-exactness tests.
For reference, find the ApmTest.Process errors here:
https://paste.googleplex.com/6372007910309888
BUG=webrtc:3853
TESTED=listened to the files output from the Process test, and verified
that they sound as expected: higher echo while the AEC is adapting, but
afterwards very close.
R=aluebs@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/31459004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7292 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-24 20:06:23 +00:00
|
|
|
} else {
|
|
|
|
|
assert(num_proc_channels_ == num_input_channels_);
|
2015-05-20 14:39:39 -07:00
|
|
|
Deinterleave(frame->data_,
|
|
|
|
|
input_num_frames_,
|
|
|
|
|
num_proc_channels_,
|
|
|
|
|
deinterleaved);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resample.
|
|
|
|
|
if (input_num_frames_ != proc_num_frames_) {
|
Enable render downmixing to mono in AudioProcessing.
In practice, we have been doing this since time immemorial, but have
relied on the user to do the downmixing (first voice engine then
Chromium). It's more logical for this burden to fall on AudioProcessing,
however, who can be expected to know that this is a reasonable approach
for AEC. Permitting two render channels results in running two AECs
serially.
Critically, in my recent change to have Chromium adopt the float
interface:
https://codereview.chromium.org/420603004
I removed the downmixing by Chromium, forgetting that we hadn't yet
enabled this feature in AudioProcessing. This corrects that oversight.
The change in paths hit by production users is very minor. As commented
it required adding downmixing to the int16_t path to satisfy
bit-exactness tests.
For reference, find the ApmTest.Process errors here:
https://paste.googleplex.com/6372007910309888
BUG=webrtc:3853
TESTED=listened to the files output from the Process test, and verified
that they sound as expected: higher echo while the AEC is adapting, but
afterwards very close.
R=aluebs@webrtc.org, bjornv@webrtc.org, kwiberg@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/31459004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7292 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-09-24 20:06:23 +00:00
|
|
|
for (int i = 0; i < num_proc_channels_; ++i) {
|
2015-05-20 14:39:39 -07:00
|
|
|
input_resamplers_[i]->Resample(input_buffer_->fbuf_const()->channels()[i],
|
|
|
|
|
input_num_frames_,
|
|
|
|
|
data_->fbuf()->channels()[i],
|
|
|
|
|
proc_num_frames_);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-15 16:57:56 +00:00
|
|
|
void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) const {
|
2015-02-10 22:52:15 +00:00
|
|
|
assert(proc_num_frames_ == output_num_frames_);
|
2014-12-11 17:09:21 +00:00
|
|
|
assert(num_channels_ == num_input_channels_);
|
|
|
|
|
assert(frame->num_channels_ == num_channels_);
|
2015-02-10 22:52:15 +00:00
|
|
|
assert(frame->samples_per_channel_ == proc_num_frames_);
|
2012-05-02 23:56:37 +00:00
|
|
|
frame->vad_activity_ = activity_;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2011-11-15 16:57:56 +00:00
|
|
|
if (!data_changed) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-20 14:39:39 -07:00
|
|
|
Interleave(data_->ibuf()->channels(),
|
|
|
|
|
proc_num_frames_,
|
|
|
|
|
num_channels_,
|
|
|
|
|
frame->data_);
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AudioBuffer::CopyLowPassToReference() {
|
|
|
|
|
reference_copied_ = true;
|
2014-12-11 17:09:21 +00:00
|
|
|
if (!low_pass_reference_channels_.get() ||
|
|
|
|
|
low_pass_reference_channels_->num_channels() != num_channels_) {
|
2014-04-22 21:00:04 +00:00
|
|
|
low_pass_reference_channels_.reset(
|
2015-02-10 22:52:15 +00:00
|
|
|
new ChannelBuffer<int16_t>(num_split_frames_,
|
2014-04-22 21:00:04 +00:00
|
|
|
num_proc_channels_));
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < num_proc_channels_; i++) {
|
2015-02-10 22:52:15 +00:00
|
|
|
memcpy(low_pass_reference_channels_->channels()[i],
|
|
|
|
|
split_bands_const(i)[kBand0To8kHz],
|
|
|
|
|
low_pass_reference_channels_->num_frames_per_band() *
|
|
|
|
|
sizeof(split_bands_const(i)[kBand0To8kHz][0]));
|
2011-07-07 08:21:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
2014-04-22 21:00:04 +00:00
|
|
|
|
2014-11-14 22:18:10 +00:00
|
|
|
void AudioBuffer::SplitIntoFrequencyBands() {
|
2015-02-10 22:52:15 +00:00
|
|
|
splitting_filter_->Analysis(data_.get(), split_data_.get());
|
2014-11-14 22:18:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AudioBuffer::MergeFrequencyBands() {
|
2015-02-10 22:52:15 +00:00
|
|
|
splitting_filter_->Synthesis(split_data_.get(), data_.get());
|
2014-11-14 22:18:10 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
} // namespace webrtc
|