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@3047 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2012-11-06 18:39:40 +00:00
parent e5b49a0472
commit ddcc9429e7
3 changed files with 26 additions and 26 deletions

View File

@ -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;
}

View File

@ -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");

View File

@ -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
}