Revert 3231 - VoE Changes to enable dual_streaming.

TEST=added new unit-test

This CL depends on issue 933015 http://webrtc-codereview.appspot.com/933015/
which is under review. Should be committed after issue 933015 is committed.
Review URL: https://webrtc-codereview.appspot.com/970005

TBR=turaj@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/929040

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3236 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
perkj@webrtc.org
2012-12-04 10:02:02 +00:00
parent e861359925
commit 2cf22a6abc
8 changed files with 52 additions and 396 deletions

View File

@ -657,111 +657,6 @@ void VoECodecImpl::ExternalToACMCodecRepresentation(CodecInst& toInst,
}
}
int VoECodecImpl::SetSecondarySendCodec(int channel, const CodecInst& codec,
int red_payload_type) {
CodecInst copy_codec;
ExternalToACMCodecRepresentation(copy_codec, codec);
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetSecondarySendCodec(channel=%d, codec)", channel);
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
"codec: plname=%s, pacsize=%d, plfreq=%d, pltype=%d, "
"channels=%d, rate=%d", codec.plname, codec.pacsize,
codec.plfreq, codec.pltype, codec.channels, codec.rate);
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
// External sanity checks performed outside the ACM
if ((STR_CASE_CMP(copy_codec.plname, "L16") == 0) &&
(copy_codec.pacsize >= 960)) {
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"SetSecondarySendCodec() invalid L16 packet size");
return -1;
}
// None of the following codecs can be registered as the secondary encoder.
if (!STR_CASE_CMP(copy_codec.plname, "CN") ||
!STR_CASE_CMP(copy_codec.plname, "TELEPHONE-EVENT") ||
!STR_CASE_CMP(copy_codec.plname, "RED")) {
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"SetSecondarySendCodec() invalid codec name");
return -1;
}
// Only mono and stereo are supported.
if ((copy_codec.channels != 1) && (copy_codec.channels != 2)) {
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"SetSecondarySendCodec() invalid number of channels");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetSecondarySendCodec() failed to locate channel");
return -1;
}
if (!AudioCodingModule::IsCodecValid(copy_codec)) {
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"SetSecondarySendCodec() invalid codec");
return -1;
}
if (channelPtr->SetSecondarySendCodec(copy_codec, red_payload_type) != 0) {
_shared->SetLastError(VE_CANNOT_SET_SECONDARY_SEND_CODEC, kTraceError,
"SetSecondarySendCodec() failed to set secondary "
"send codec");
return -1;
}
return 0;
}
int VoECodecImpl::GetSecondarySendCodec(int channel, CodecInst& codec) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"GetSecondarySendCodec(channel=%d, codec=?)", channel);
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetSecondarySendCodec() failed to locate channel");
return -1;
}
CodecInst acm_codec;
if (channelPtr->GetSecondarySendCodec(&acm_codec) != 0) {
_shared->SetLastError(VE_CANNOT_GET_SECONDARY_SEND_CODEC, kTraceError,
"GetSecondarySendCodec() failed to get secondary "
"send codec");
return -1;
}
ACMToExternalCodecRepresentation(codec, acm_codec);
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
VoEId(_shared->instance_id(), -1),
"GetSecondarySendCodec() => plname=%s, pacsize=%d, plfreq=%d, "
"channels=%d, rate=%d", codec.plname, codec.pacsize,
codec.plfreq, codec.channels, codec.rate);
return 0;
}
int VoECodecImpl::RemoveSecondarySendCodec(int channel) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"RemoveSecondarySendCodec(channel=%d)", channel);
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"RemoveSecondarySendCodec() failed to locate "
"channel");
return -1;
}
channelPtr->RemoveSecondarySendCodec();
return 0;
}
#endif // WEBRTC_VOICE_ENGINE_CODEC_API
} // namespace webrtc