Use ProcessReverseStream in VoiceEngines OutputMixer
Review URL: https://codereview.webrtc.org/1776363002 Cr-Commit-Position: refs/heads/master@{#12044}
This commit is contained in:
parent
56d4d059ac
commit
da116c4c37
@ -57,7 +57,6 @@ class FakeAudioProcessing : public webrtc::AudioProcessing {
|
||||
experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled;
|
||||
}
|
||||
|
||||
WEBRTC_STUB_CONST(input_sample_rate_hz, ());
|
||||
WEBRTC_STUB_CONST(proc_sample_rate_hz, ());
|
||||
WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ());
|
||||
size_t num_input_channels() const override { return 0; }
|
||||
|
||||
@ -419,12 +419,6 @@ void AudioProcessingImpl::SetExtraOptions(const Config& config) {
|
||||
#endif // WEBRTC_ANDROID_PLATFORM_BUILD
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::input_sample_rate_hz() const {
|
||||
// Accessed from outside APM, hence a lock is needed.
|
||||
rtc::CritScope cs(&crit_capture_);
|
||||
return formats_.api_format.input_stream().sample_rate_hz();
|
||||
}
|
||||
|
||||
int AudioProcessingImpl::proc_sample_rate_hz() const {
|
||||
// Used as callback from submodules, hence locking is not allowed.
|
||||
return capture_nonlocked_.fwd_proc_format.sample_rate_hz();
|
||||
@ -842,8 +836,8 @@ int AudioProcessingImpl::AnalyzeReverseStreamLocked(
|
||||
|
||||
int AudioProcessingImpl::ProcessReverseStream(AudioFrame* frame) {
|
||||
TRACE_EVENT0("webrtc", "AudioProcessing::ProcessReverseStream_AudioFrame");
|
||||
RETURN_ON_ERR(AnalyzeReverseStream(frame));
|
||||
rtc::CritScope cs(&crit_render_);
|
||||
RETURN_ON_ERR(AnalyzeReverseStream(frame));
|
||||
if (is_rev_processed()) {
|
||||
render_.render_audio->InterleaveTo(frame, true);
|
||||
}
|
||||
|
||||
@ -83,7 +83,6 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
void set_delay_offset_ms(int offset) override;
|
||||
int delay_offset_ms() const override;
|
||||
void set_stream_key_pressed(bool key_pressed) override;
|
||||
int input_sample_rate_hz() const override;
|
||||
|
||||
// Render-side exclusive methods possibly running APM in a
|
||||
// multi-threaded manner. Acquire the render lock.
|
||||
|
||||
@ -296,10 +296,6 @@ class AudioProcessing {
|
||||
// ensures the options are applied immediately.
|
||||
virtual void SetExtraOptions(const Config& config) = 0;
|
||||
|
||||
// TODO(peah): Remove after voice engine no longer requires it to resample
|
||||
// the reverse stream to the forward rate.
|
||||
virtual int input_sample_rate_hz() const = 0;
|
||||
|
||||
// TODO(ajm): Only intended for internal use. Make private and friend the
|
||||
// necessary classes?
|
||||
virtual int proc_sample_rate_hz() const = 0;
|
||||
@ -367,8 +363,7 @@ class AudioProcessing {
|
||||
// chances are you don't need to use it.
|
||||
//
|
||||
// The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_|
|
||||
// members of |frame| must be valid. |sample_rate_hz_| must correspond to
|
||||
// |input_sample_rate_hz()|
|
||||
// members of |frame| must be valid.
|
||||
//
|
||||
// TODO(ajm): add const to input; requires an implementation fix.
|
||||
// DEPRECATED: Use |ProcessReverseStream| instead.
|
||||
|
||||
@ -492,14 +492,7 @@ OutputMixer::DoOperationsOnCombinedSignal(bool feed_data_to_apm)
|
||||
|
||||
// --- Far-end Voice Quality Enhancement (AudioProcessing Module)
|
||||
if (feed_data_to_apm) {
|
||||
// Convert from mixing to AudioProcessing sample rate, similarly to how it
|
||||
// is done on the send side. Downmix to mono.
|
||||
AudioFrame frame;
|
||||
frame.num_channels_ = 1;
|
||||
frame.sample_rate_hz_ = _audioProcessingModulePtr->input_sample_rate_hz();
|
||||
RemixAndResample(_audioFrame, &audioproc_resampler_, &frame);
|
||||
|
||||
if (_audioProcessingModulePtr->AnalyzeReverseStream(&frame) != 0) {
|
||||
if (_audioProcessingModulePtr->ProcessReverseStream(&_audioFrame) != 0) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
||||
"AudioProcessingModule::AnalyzeReverseStream() => error");
|
||||
RTC_DCHECK(false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user