Remove deprecated Audio Processing APIs
This change removes the deprecated ChannelLayout versions of ProcessStream and AnalyzeReverseStream. Bug: webrtc:5298 Change-Id: I8a7e33e89cffac5eceecd00dfd3c96000643f51b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158529 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29641}
This commit is contained in:
parent
6e4e68852a
commit
cb30726646
@ -834,38 +834,6 @@ void AudioProcessingImpl::RuntimeSettingEnqueuer::Enqueue(
|
||||
RTC_LOG(LS_ERROR) << "Cannot enqueue a new runtime setting.";
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::ProcessStream(const float* const* src,
|
||||
size_t samples_per_channel,
|
||||
int input_sample_rate_hz,
|
||||
ChannelLayout input_layout,
|
||||
int output_sample_rate_hz,
|
||||
ChannelLayout output_layout,
|
||||
float* const* dest) {
|
||||
TRACE_EVENT0("webrtc", "AudioProcessing::ProcessStream_ChannelLayout");
|
||||
StreamConfig input_stream;
|
||||
StreamConfig output_stream;
|
||||
{
|
||||
// Access the formats_.api_format.input_stream beneath the capture lock.
|
||||
// The lock must be released as it is later required in the call
|
||||
// to ProcessStream(,,,);
|
||||
rtc::CritScope cs(&crit_capture_);
|
||||
input_stream = formats_.api_format.input_stream();
|
||||
output_stream = formats_.api_format.output_stream();
|
||||
}
|
||||
|
||||
input_stream.set_sample_rate_hz(input_sample_rate_hz);
|
||||
input_stream.set_num_channels(ChannelsFromLayout(input_layout));
|
||||
input_stream.set_has_keyboard(LayoutHasKeyboard(input_layout));
|
||||
output_stream.set_sample_rate_hz(output_sample_rate_hz);
|
||||
output_stream.set_num_channels(ChannelsFromLayout(output_layout));
|
||||
output_stream.set_has_keyboard(LayoutHasKeyboard(output_layout));
|
||||
|
||||
if (samples_per_channel != input_stream.num_frames()) {
|
||||
return kBadDataLengthError;
|
||||
}
|
||||
return ProcessStream(src, input_stream, output_stream, dest);
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::ProcessStream(const float* const* src,
|
||||
const StreamConfig& input_config,
|
||||
const StreamConfig& output_config,
|
||||
@ -1477,23 +1445,6 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::AnalyzeReverseStream(const float* const* data,
|
||||
size_t samples_per_channel,
|
||||
int sample_rate_hz,
|
||||
ChannelLayout layout) {
|
||||
TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_ChannelLayout");
|
||||
rtc::CritScope cs(&crit_render_);
|
||||
const StreamConfig reverse_config = {
|
||||
sample_rate_hz,
|
||||
ChannelsFromLayout(layout),
|
||||
LayoutHasKeyboard(layout),
|
||||
};
|
||||
if (samples_per_channel != reverse_config.num_frames()) {
|
||||
return kBadDataLengthError;
|
||||
}
|
||||
return AnalyzeReverseStreamLocked(data, reverse_config, reverse_config);
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::AnalyzeReverseStream(
|
||||
const float* const* data,
|
||||
const StreamConfig& reverse_config) {
|
||||
|
||||
@ -82,13 +82,6 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
// Capture-side exclusive methods possibly running APM in a
|
||||
// multi-threaded manner. Acquire the capture lock.
|
||||
int ProcessStream(AudioFrame* frame) override;
|
||||
int ProcessStream(const float* const* src,
|
||||
size_t samples_per_channel,
|
||||
int input_sample_rate_hz,
|
||||
ChannelLayout input_layout,
|
||||
int output_sample_rate_hz,
|
||||
ChannelLayout output_layout,
|
||||
float* const* dest) override;
|
||||
int ProcessStream(const float* const* src,
|
||||
const StreamConfig& input_config,
|
||||
const StreamConfig& output_config,
|
||||
@ -104,10 +97,6 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
// Render-side exclusive methods possibly running APM in a
|
||||
// multi-threaded manner. Acquire the render lock.
|
||||
int ProcessReverseStream(AudioFrame* frame) override;
|
||||
int AnalyzeReverseStream(const float* const* data,
|
||||
size_t samples_per_channel,
|
||||
int sample_rate_hz,
|
||||
ChannelLayout layout) override;
|
||||
int AnalyzeReverseStream(const float* const* data,
|
||||
const StreamConfig& reverse_config) override;
|
||||
int ProcessReverseStream(const float* const* src,
|
||||
|
||||
@ -30,16 +30,15 @@ class AudioProcessingImplLockTest;
|
||||
|
||||
// Type of the render thread APM API call to use in the test.
|
||||
enum class RenderApiImpl {
|
||||
ProcessReverseStreamImpl1,
|
||||
ProcessReverseStreamImpl2,
|
||||
AnalyzeReverseStreamImpl
|
||||
ProcessReverseStreamImplAudioFrame,
|
||||
ProcessReverseStreamImplStreamConfig,
|
||||
AnalyzeReverseStreamImplStreamConfig,
|
||||
};
|
||||
|
||||
// Type of the capture thread APM API call to use in the test.
|
||||
enum class CaptureApiImpl {
|
||||
ProcessStreamImpl1,
|
||||
ProcessStreamImpl2,
|
||||
ProcessStreamImpl3
|
||||
ProcessStreamImplAudioFrame,
|
||||
ProcessStreamImplStreamConfig
|
||||
};
|
||||
|
||||
// The runtime parameter setting scheme to use in the test.
|
||||
@ -138,15 +137,18 @@ struct TestConfig {
|
||||
// Only test 16 kHz for this test suite.
|
||||
test_config.initial_sample_rate_hz = 16000;
|
||||
|
||||
// Create test config for the second processing API function set.
|
||||
// Create test config for the AudioFrame processing API function set.
|
||||
test_config.render_api_function =
|
||||
RenderApiImpl::ProcessReverseStreamImpl2;
|
||||
test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl2;
|
||||
|
||||
// Create test config for the first processing API function set.
|
||||
RenderApiImpl::ProcessReverseStreamImplAudioFrame;
|
||||
test_config.capture_api_function =
|
||||
CaptureApiImpl::ProcessStreamImplAudioFrame;
|
||||
test_configs.push_back(test_config);
|
||||
test_config.render_api_function = RenderApiImpl::AnalyzeReverseStreamImpl;
|
||||
test_config.capture_api_function = CaptureApiImpl::ProcessStreamImpl3;
|
||||
|
||||
// Create test config for the StreamConfig processing API function set.
|
||||
test_config.render_api_function =
|
||||
RenderApiImpl::ProcessReverseStreamImplStreamConfig;
|
||||
test_config.capture_api_function =
|
||||
CaptureApiImpl::ProcessStreamImplStreamConfig;
|
||||
test_configs.push_back(test_config);
|
||||
}
|
||||
|
||||
@ -165,16 +167,16 @@ struct TestConfig {
|
||||
};
|
||||
|
||||
const AllowedApiCallCombinations api_calls[] = {
|
||||
{RenderApiImpl::ProcessReverseStreamImpl1,
|
||||
CaptureApiImpl::ProcessStreamImpl1},
|
||||
{RenderApiImpl::ProcessReverseStreamImpl2,
|
||||
CaptureApiImpl::ProcessStreamImpl2},
|
||||
{RenderApiImpl::ProcessReverseStreamImpl2,
|
||||
CaptureApiImpl::ProcessStreamImpl3},
|
||||
{RenderApiImpl::AnalyzeReverseStreamImpl,
|
||||
CaptureApiImpl::ProcessStreamImpl2},
|
||||
{RenderApiImpl::AnalyzeReverseStreamImpl,
|
||||
CaptureApiImpl::ProcessStreamImpl3}};
|
||||
{RenderApiImpl::ProcessReverseStreamImplAudioFrame,
|
||||
CaptureApiImpl::ProcessStreamImplAudioFrame},
|
||||
{RenderApiImpl::ProcessReverseStreamImplStreamConfig,
|
||||
CaptureApiImpl::ProcessStreamImplStreamConfig},
|
||||
{RenderApiImpl::AnalyzeReverseStreamImplStreamConfig,
|
||||
CaptureApiImpl::ProcessStreamImplStreamConfig},
|
||||
{RenderApiImpl::ProcessReverseStreamImplAudioFrame,
|
||||
CaptureApiImpl::ProcessStreamImplStreamConfig},
|
||||
{RenderApiImpl::ProcessReverseStreamImplStreamConfig,
|
||||
CaptureApiImpl::ProcessStreamImplAudioFrame}};
|
||||
std::vector<TestConfig> out;
|
||||
for (auto api_call : api_calls) {
|
||||
test_config.render_api_function = api_call.render_api;
|
||||
@ -249,8 +251,10 @@ struct TestConfig {
|
||||
add_aec_settings(add_processing_apis(test_config))));
|
||||
}
|
||||
|
||||
RenderApiImpl render_api_function = RenderApiImpl::ProcessReverseStreamImpl2;
|
||||
CaptureApiImpl capture_api_function = CaptureApiImpl::ProcessStreamImpl2;
|
||||
RenderApiImpl render_api_function =
|
||||
RenderApiImpl::ProcessReverseStreamImplStreamConfig;
|
||||
CaptureApiImpl capture_api_function =
|
||||
CaptureApiImpl::ProcessStreamImplStreamConfig;
|
||||
RuntimeParameterSettingScheme runtime_parameter_setting_scheme =
|
||||
RuntimeParameterSettingScheme::ExtremeStreamMetadataChangeScheme;
|
||||
int initial_sample_rate_hz = 16000;
|
||||
@ -641,7 +645,7 @@ void CaptureProcessor::PrepareFrame() {
|
||||
// Restrict to a common fixed sample rate if the AudioFrame
|
||||
// interface is used.
|
||||
if (test_config_->capture_api_function ==
|
||||
CaptureApiImpl::ProcessStreamImpl1) {
|
||||
CaptureApiImpl::ProcessStreamImplAudioFrame) {
|
||||
frame_data_.input_sample_rate_hz = test_config_->initial_sample_rate_hz;
|
||||
frame_data_.output_sample_rate_hz = test_config_->initial_sample_rate_hz;
|
||||
}
|
||||
@ -697,17 +701,10 @@ void CaptureProcessor::CallApmCaptureSide() {
|
||||
// Call the specified capture side API processing method.
|
||||
int result = AudioProcessing::kNoError;
|
||||
switch (test_config_->capture_api_function) {
|
||||
case CaptureApiImpl::ProcessStreamImpl1:
|
||||
case CaptureApiImpl::ProcessStreamImplAudioFrame:
|
||||
result = apm_->ProcessStream(&frame_data_.frame);
|
||||
break;
|
||||
case CaptureApiImpl::ProcessStreamImpl2:
|
||||
result = apm_->ProcessStream(
|
||||
&frame_data_.input_frame[0], frame_data_.input_samples_per_channel,
|
||||
frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout,
|
||||
frame_data_.output_sample_rate_hz, frame_data_.output_channel_layout,
|
||||
&frame_data_.output_frame[0]);
|
||||
break;
|
||||
case CaptureApiImpl::ProcessStreamImpl3:
|
||||
case CaptureApiImpl::ProcessStreamImplStreamConfig:
|
||||
result = apm_->ProcessStream(
|
||||
&frame_data_.input_frame[0], frame_data_.input_stream_config,
|
||||
frame_data_.output_stream_config, &frame_data_.output_frame[0]);
|
||||
@ -908,7 +905,7 @@ void RenderProcessor::PrepareFrame() {
|
||||
// Restrict to a common fixed sample rate if the AudioFrame interface is
|
||||
// used.
|
||||
if ((test_config_->render_api_function ==
|
||||
RenderApiImpl::ProcessReverseStreamImpl1) ||
|
||||
RenderApiImpl::ProcessReverseStreamImplAudioFrame) ||
|
||||
(test_config_->aec_type !=
|
||||
AecType::BasicWebRtcAecSettingsWithAecMobile)) {
|
||||
frame_data_.input_sample_rate_hz = test_config_->initial_sample_rate_hz;
|
||||
@ -960,18 +957,17 @@ void RenderProcessor::CallApmRenderSide() {
|
||||
// Call the specified render side API processing method.
|
||||
int result = AudioProcessing::kNoError;
|
||||
switch (test_config_->render_api_function) {
|
||||
case RenderApiImpl::ProcessReverseStreamImpl1:
|
||||
case RenderApiImpl::ProcessReverseStreamImplAudioFrame:
|
||||
result = apm_->ProcessReverseStream(&frame_data_.frame);
|
||||
break;
|
||||
case RenderApiImpl::ProcessReverseStreamImpl2:
|
||||
case RenderApiImpl::ProcessReverseStreamImplStreamConfig:
|
||||
result = apm_->ProcessReverseStream(
|
||||
&frame_data_.input_frame[0], frame_data_.input_stream_config,
|
||||
frame_data_.output_stream_config, &frame_data_.output_frame[0]);
|
||||
break;
|
||||
case RenderApiImpl::AnalyzeReverseStreamImpl:
|
||||
result = apm_->AnalyzeReverseStream(
|
||||
&frame_data_.input_frame[0], frame_data_.input_samples_per_channel,
|
||||
frame_data_.input_sample_rate_hz, frame_data_.input_channel_layout);
|
||||
case RenderApiImpl::AnalyzeReverseStreamImplStreamConfig:
|
||||
result = apm_->AnalyzeReverseStream(&frame_data_.input_frame[0],
|
||||
frame_data_.input_stream_config);
|
||||
break;
|
||||
default:
|
||||
FAIL();
|
||||
|
||||
@ -567,9 +567,9 @@ int ApmTest::ProcessStreamChooser(Format format) {
|
||||
return apm_->ProcessStream(&frame_);
|
||||
}
|
||||
return apm_->ProcessStream(
|
||||
float_cb_->channels(), frame_.samples_per_channel_,
|
||||
frame_.sample_rate_hz_, LayoutFromChannels(frame_.num_channels_),
|
||||
output_sample_rate_hz_, LayoutFromChannels(num_output_channels_),
|
||||
float_cb_->channels(),
|
||||
StreamConfig(frame_.sample_rate_hz_, frame_.num_channels_),
|
||||
StreamConfig(output_sample_rate_hz_, num_output_channels_),
|
||||
float_cb_->channels());
|
||||
}
|
||||
|
||||
@ -578,8 +578,8 @@ int ApmTest::AnalyzeReverseStreamChooser(Format format) {
|
||||
return apm_->ProcessReverseStream(&revframe_);
|
||||
}
|
||||
return apm_->AnalyzeReverseStream(
|
||||
revfloat_cb_->channels(), revframe_.samples_per_channel_,
|
||||
revframe_.sample_rate_hz_, LayoutFromChannels(revframe_.num_channels_));
|
||||
revfloat_cb_->channels(),
|
||||
StreamConfig(revframe_.sample_rate_hz_, revframe_.num_channels_));
|
||||
}
|
||||
|
||||
void ApmTest::ProcessDelayVerificationTest(int delay_ms,
|
||||
@ -1148,9 +1148,9 @@ TEST_F(ApmTest, NoProcessingWhenAllComponentsDisabledFloat) {
|
||||
auto dest_channels = &dest[0];
|
||||
|
||||
apm_.reset(AudioProcessingBuilder().Create());
|
||||
EXPECT_NOERR(apm_->ProcessStream(&src_channels, kSamples, sample_rate,
|
||||
LayoutFromChannels(1), sample_rate,
|
||||
LayoutFromChannels(1), &dest_channels));
|
||||
EXPECT_NOERR(apm_->ProcessStream(&src_channels, StreamConfig(sample_rate, 1),
|
||||
StreamConfig(sample_rate, 1),
|
||||
&dest_channels));
|
||||
|
||||
for (size_t i = 0; i < kSamples; ++i) {
|
||||
EXPECT_EQ(src[i], dest[i]);
|
||||
@ -1709,12 +1709,16 @@ TEST_F(ApmTest, NoErrorsWithKeyboardChannel) {
|
||||
TotalChannelsFromLayout(cf[i].in_layout));
|
||||
ChannelBuffer<float> out_cb(SamplesFromRate(out_rate),
|
||||
ChannelsFromLayout(cf[i].out_layout));
|
||||
bool has_keyboard = cf[i].in_layout == AudioProcessing::kMonoAndKeyboard ||
|
||||
cf[i].in_layout == AudioProcessing::kStereoAndKeyboard;
|
||||
StreamConfig in_sc(in_rate, ChannelsFromLayout(cf[i].in_layout),
|
||||
has_keyboard);
|
||||
StreamConfig out_sc(out_rate, ChannelsFromLayout(cf[i].out_layout));
|
||||
|
||||
// Run over a few chunks.
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
EXPECT_NOERR(ap->ProcessStream(in_cb.channels(), in_cb.num_frames(),
|
||||
in_rate, cf[i].in_layout, out_rate,
|
||||
cf[i].out_layout, out_cb.channels()));
|
||||
EXPECT_NOERR(ap->ProcessStream(in_cb.channels(), in_sc, out_sc,
|
||||
out_cb.channels()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1881,9 +1885,8 @@ class AudioProcessingTest
|
||||
ap->set_stream_analog_level(analog_level);
|
||||
|
||||
EXPECT_NOERR(ap->ProcessStream(
|
||||
fwd_cb.channels(), fwd_cb.num_frames(), input_rate,
|
||||
LayoutFromChannels(num_input_channels), output_rate,
|
||||
LayoutFromChannels(num_output_channels), out_cb.channels()));
|
||||
fwd_cb.channels(), StreamConfig(input_rate, num_input_channels),
|
||||
StreamConfig(output_rate, num_output_channels), out_cb.channels()));
|
||||
|
||||
// Dump forward output to file.
|
||||
Interleave(out_cb.channels(), out_cb.num_frames(), out_cb.num_channels(),
|
||||
|
||||
@ -542,23 +542,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
|
||||
// method, it will trigger an initialization.
|
||||
virtual int ProcessStream(AudioFrame* frame) = 0;
|
||||
|
||||
// Accepts deinterleaved float audio with the range [-1, 1]. Each element
|
||||
// of |src| points to a channel buffer, arranged according to
|
||||
// |input_layout|. At output, the channels will be arranged according to
|
||||
// |output_layout| at |output_sample_rate_hz| in |dest|.
|
||||
//
|
||||
// The output layout must have one channel or as many channels as the input.
|
||||
// |src| and |dest| may use the same memory, if desired.
|
||||
//
|
||||
// TODO(mgraczyk): Remove once clients are updated to use the new interface.
|
||||
virtual int ProcessStream(const float* const* src,
|
||||
size_t samples_per_channel,
|
||||
int input_sample_rate_hz,
|
||||
ChannelLayout input_layout,
|
||||
int output_sample_rate_hz,
|
||||
ChannelLayout output_layout,
|
||||
float* const* dest) = 0;
|
||||
|
||||
// Accepts deinterleaved float audio with the range [-1, 1]. Each element of
|
||||
// |src| points to a channel buffer, arranged according to |input_stream|. At
|
||||
// output, the channels will be arranged according to |output_stream| in
|
||||
@ -585,20 +568,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
|
||||
// members of |frame| must be valid.
|
||||
virtual int ProcessReverseStream(AudioFrame* frame) = 0;
|
||||
|
||||
// Accepts deinterleaved float audio with the range [-1, 1]. Each element
|
||||
// of |data| points to a channel buffer, arranged according to |layout|.
|
||||
// TODO(mgraczyk): Remove once clients are updated to use the new interface.
|
||||
virtual int AnalyzeReverseStream(const float* const* data,
|
||||
size_t samples_per_channel,
|
||||
int sample_rate_hz,
|
||||
ChannelLayout layout) = 0;
|
||||
|
||||
// Accepts deinterleaved float audio with the range [-1, 1]. Each element
|
||||
// of |data| points to a channel buffer, arranged according to
|
||||
// |reverse_config|.
|
||||
virtual int AnalyzeReverseStream(const float* const* data,
|
||||
const StreamConfig& reverse_config) = 0;
|
||||
|
||||
// Accepts deinterleaved float audio with the range [-1, 1]. Each element of
|
||||
// |data| points to a channel buffer, arranged according to |reverse_config|.
|
||||
virtual int ProcessReverseStream(const float* const* src,
|
||||
@ -606,6 +575,12 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
|
||||
const StreamConfig& output_config,
|
||||
float* const* dest) = 0;
|
||||
|
||||
// Accepts deinterleaved float audio with the range [-1, 1]. Each element
|
||||
// of |data| points to a channel buffer, arranged according to
|
||||
// |reverse_config|.
|
||||
virtual int AnalyzeReverseStream(const float* const* data,
|
||||
const StreamConfig& reverse_config) = 0;
|
||||
|
||||
// This must be called prior to ProcessStream() if and only if adaptive analog
|
||||
// gain control is enabled, to pass the current analog level from the audio
|
||||
// HAL. Must be within the range provided in Config::GainController1.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user