summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2012-11-06 18:39:40 +0000
committerandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2012-11-06 18:39:40 +0000
commit0dd483fedbcd03506db5e382204543020f168a4d (patch)
tree21133262e500244ec21d71417b95df7036d6f346
parenta8054d44fcf5a5b9b3bda4ece4dc853529b7d74c (diff)
downloadwebrtc-0dd483fedbcd03506db5e382204543020f168a4d.tar.gz
Check the channels in receive-side processing frames.
The number of channels must be set correctly before calling ProcessStream. This was preventing stereo frames from being processed. Also fix voe_cmd_test, which wasn't enabling rx NS properly. BUG=issue713, 7375579 Review URL: https://webrtc-codereview.appspot.com/929013 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3047 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--voice_engine/channel.cc28
-rw-r--r--voice_engine/test/cmd_test/voe_cmd_test.cc16
-rw-r--r--voice_engine/voe_audio_processing_impl.cc8
3 files changed, 26 insertions, 26 deletions
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc
index 6bb5454c..3cca5db9 100644
--- a/voice_engine/channel.cc
+++ b/voice_engine/channel.cc
@@ -4744,7 +4744,6 @@ Channel::SetRxAgcStatus(const bool enable, const AgcModes mode)
}
_rxAgcIsEnabled = enable;
-
_rxApmIsEnabled = ((_rxAgcIsEnabled == true) || (_rxNsIsEnabled == true));
return 0;
@@ -6622,26 +6621,27 @@ Channel::ApmProcessRx(AudioFrame& audioFrame)
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::ApmProcessRx()");
- // Reset the APM frequency if the frequency has changed
- if (_rxAudioProcessingModulePtr->sample_rate_hz() !=
- audioFrame.sample_rate_hz_)
- {
- if (_rxAudioProcessingModulePtr->set_sample_rate_hz(
+ // Register the (possibly new) frame parameters.
+ if (_rxAudioProcessingModulePtr->set_sample_rate_hz(
audioFrame.sample_rate_hz_) != 0)
- {
- WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1),
- "AudioProcessingModule::set_sample_rate_hz("
- "sample_rate_hz_=%u) => error",
- _audioFrame.sample_rate_hz_);
- }
+ {
+ WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1),
+ "AudioProcessingModule::set_sample_rate_hz(%u) => error",
+ audioFrame.sample_rate_hz_);
+ }
+ if (_rxAudioProcessingModulePtr->set_num_channels(audioFrame.num_channels_,
+ audioFrame.num_channels_) != 0)
+ {
+ WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1),
+ "AudioProcessingModule::set_num_channels(%u, %u) => error",
+ audioFrame.num_channels_, audioFrame.num_channels_);
}
if (_rxAudioProcessingModulePtr->ProcessStream(&audioFrame) != 0)
{
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1),
- "AudioProcessingModule::ProcessStream() => error");
+ "AudioProcessingModule::ProcessStream() => error");
}
-
return 0;
}
diff --git a/voice_engine/test/cmd_test/voe_cmd_test.cc b/voice_engine/test/cmd_test/voe_cmd_test.cc
index 87530026..bf609469 100644
--- a/voice_engine/test/cmd_test/voe_cmd_test.cc
+++ b/voice_engine/test/cmd_test/voe_cmd_test.cc
@@ -235,10 +235,10 @@ void RunTest(std::string out_path) {
int codecinput;
bool AEC = false;
bool AGC = true;
- bool AGC1 = false;
+ bool rx_agc = false;
bool VAD = false;
bool NS = false;
- bool NS1 = false;
+ bool rx_ns = false;
bool typing_detection = false;
bool muted = false;
bool on_hold = false;
@@ -677,20 +677,20 @@ void RunTest(std::string out_path) {
}
else if (codecinput == (noCodecs + 14)) {
// Remote AGC
- AGC1 = !AGC1;
- res = apm->SetRxAgcStatus(chan, AGC1);
+ rx_agc = !rx_agc;
+ res = apm->SetRxAgcStatus(chan, rx_agc);
VALIDATE;
- if (AGC1)
+ if (rx_agc)
printf("\n Receive-side AGC is now on! \n");
else
printf("\n Receive-side AGC is now off! \n");
}
else if (codecinput == (noCodecs + 15)) {
// Remote NS
- NS1 = !NS1;
- res = apm->SetRxNsStatus(chan, NS);
+ rx_ns = !rx_ns;
+ res = apm->SetRxNsStatus(chan, rx_ns);
VALIDATE;
- if (NS1)
+ if (rx_ns)
printf("\n Receive-side NS is now on! \n");
else
printf("\n Receive-side NS is now off! \n");
diff --git a/voice_engine/voe_audio_processing_impl.cc b/voice_engine/voe_audio_processing_impl.cc
index 63909709..62440f4e 100644
--- a/voice_engine/voe_audio_processing_impl.cc
+++ b/voice_engine/voe_audio_processing_impl.cc
@@ -356,7 +356,7 @@ int VoEAudioProcessingImpl::SetRxNsStatus(int channel,
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetRxNsStatus(channel=%d, enable=%d, mode=%d)",
channel, (int)enable, (int)mode);
-#ifdef WEBRTC_VOICE_ENGINE_AGC
+#ifdef WEBRTC_VOICE_ENGINE_NR
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
@@ -372,7 +372,7 @@ int VoEAudioProcessingImpl::SetRxNsStatus(int channel,
return channelPtr->SetRxNsStatus(enable, mode);
#else
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
- "SetRxNsStatus() AGC is not supported");
+ "SetRxNsStatus() NS is not supported");
return -1;
#endif
}
@@ -382,7 +382,7 @@ int VoEAudioProcessingImpl::GetRxNsStatus(int channel,
NsModes& mode) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"GetRxNsStatus(channel=%d, enable=?, mode=?)", channel);
-#ifdef WEBRTC_VOICE_ENGINE_AGC
+#ifdef WEBRTC_VOICE_ENGINE_NR
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
@@ -398,7 +398,7 @@ int VoEAudioProcessingImpl::GetRxNsStatus(int channel,
return channelPtr->GetRxNsStatus(enabled, mode);
#else
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
- "GetRxNsStatus() Agc is not supported");
+ "GetRxNsStatus() NS is not supported");
return -1;
#endif
}