Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2516993002: Pass SdpAudioFormat through Channel, without converting to CodecInst (Closed)
Patch Set: add TODO Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 68f2e2d95c34e2ece65ed4008c57b716994e3a91..5231691b552d62b11eccee9e874b517058522388 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -1372,6 +1372,11 @@ int32_t Channel::GetVADStatus(bool& enabledVAD,
}
int32_t Channel::SetRecPayloadType(const CodecInst& codec) {
+ return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec));
+}
+
+int32_t Channel::SetRecPayloadType(int payload_type,
+ const SdpAudioFormat& format) {
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::SetRecPayloadType()");
@@ -1382,7 +1387,22 @@ int32_t Channel::SetRecPayloadType(const CodecInst& codec) {
return -1;
}
- if (codec.pltype == -1) {
+ const CodecInst codec = [&] {
+ CodecInst c = SdpToCodecInst(payload_type, format);
+
+ // Bug 6986: Emulate an old bug that caused us to always choose to decode
+ // Opus in stereo. To be able to remove this, we first need to fix the
+ // other half of bug 6986, which is about losing the Opus "stereo"
+ // parameter.
+ // TODO(kwiberg): Remove this special case, a.k.a. fix bug 6986.
+ if (STR_CASE_CMP(codec.plname, "opus") == 0) {
+ c.channels = 2;
+ }
+
+ return c;
+ }();
+
+ if (payload_type == -1) {
// De-register the selected codec (RTP/RTCP module and ACM)
int8_t pltype(-1);
@@ -1420,11 +1440,9 @@ int32_t Channel::SetRecPayloadType(const CodecInst& codec) {
return -1;
}
}
- if (!audio_coding_->RegisterReceiveCodec(codec.pltype,
- CodecInstToSdp(codec))) {
- audio_coding_->UnregisterReceiveCodec(codec.pltype);
- if (!audio_coding_->RegisterReceiveCodec(codec.pltype,
- CodecInstToSdp(codec))) {
+ if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) {
+ audio_coding_->UnregisterReceiveCodec(payload_type);
+ if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) {
_engineStatisticsPtr->SetLastError(
VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
"SetRecPayloadType() ACM registration failed - 1");
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698