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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2774833003: Reland "WebRtcVoiceMediaChannel::AddRecvStream: Don't call SetRecPayloadType" (Closed)
Patch Set: Don't stop setting up a default set of send codecs Created 3 years, 9 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 d2b30ca8f7d41c07b7ea406e6f26a84d59699ca5..43766b4140cd96960b13304bcc64f8d1511a8433 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -987,16 +987,50 @@ int32_t Channel::Init() {
return -1;
}
- // --- Register all supported codecs to the receiving side of the
- // RTP/RTCP module
+ // Register a default set of send codecs.
+ const int nSupportedCodecs = AudioCodingModule::NumberOfCodecs();
+ for (int idx = 0; idx < nSupportedCodecs; idx++) {
+ CodecInst codec;
+ RTC_CHECK_EQ(0, audio_coding_->Codec(idx, &codec));
- CodecInst codec;
- const uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs();
+ // Ensure that PCMU is used as default send codec.
+ if (STR_CASE_CMP(codec.plname, "PCMU") == 0 && codec.channels == 1) {
+ SetSendCodec(codec);
+ }
+ // Register default PT for 'telephone-event'
+ if (STR_CASE_CMP(codec.plname, "telephone-event") == 0) {
+ if (_rtpRtcpModule->RegisterSendPayload(codec) == -1) {
+ WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
+ "Channel::Init() failed to register outband "
+ "'telephone-event' (%d/%d) correctly",
+ codec.pltype, codec.plfreq);
+ }
+ }
+
+ if (STR_CASE_CMP(codec.plname, "CN") == 0) {
+ if (!codec_manager_.RegisterEncoder(codec) ||
+ !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get()) ||
+ _rtpRtcpModule->RegisterSendPayload(codec) == -1) {
+ WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
+ "Channel::Init() failed to register CN (%d/%d) "
+ "correctly - 1",
+ codec.pltype, codec.plfreq);
+ }
+ }
+ }
+
+ return 0;
+}
+
+void Channel::RegisterLegacyReceiveCodecs() {
+ const int nSupportedCodecs = AudioCodingModule::NumberOfCodecs();
for (int idx = 0; idx < nSupportedCodecs; idx++) {
+ CodecInst codec;
+ RTC_CHECK_EQ(0, audio_coding_->Codec(idx, &codec));
+
// Open up the RTP/RTCP receiver for all supported codecs
- if ((audio_coding_->Codec(idx, &codec) == -1) ||
- (rtp_receiver_->RegisterReceivePayload(codec) == -1)) {
+ if (rtp_receiver_->RegisterReceivePayload(codec) == -1) {
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::Init() unable to register %s "
"(%d/%d/%" PRIuS "/%d) to RTP/RTCP receiver",
@@ -1011,29 +1045,20 @@ int32_t Channel::Init() {
codec.rate);
}
- // Ensure that PCMU is used as default codec on the sending side
- if (!STR_CASE_CMP(codec.plname, "PCMU") && (codec.channels == 1)) {
- SetSendCodec(codec);
- }
-
- // Register default PT for outband 'telephone-event'
- if (!STR_CASE_CMP(codec.plname, "telephone-event")) {
- if (_rtpRtcpModule->RegisterSendPayload(codec) == -1 ||
- !audio_coding_->RegisterReceiveCodec(codec.pltype,
+ // Register default PT for 'telephone-event'
+ if (STR_CASE_CMP(codec.plname, "telephone-event") == 0) {
+ if (!audio_coding_->RegisterReceiveCodec(codec.pltype,
CodecInstToSdp(codec))) {
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
- "Channel::Init() failed to register outband "
+ "Channel::Init() failed to register inband "
"'telephone-event' (%d/%d) correctly",
codec.pltype, codec.plfreq);
}
}
- if (!STR_CASE_CMP(codec.plname, "CN")) {
- if (!codec_manager_.RegisterEncoder(codec) ||
- !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get()) ||
- !audio_coding_->RegisterReceiveCodec(codec.pltype,
- CodecInstToSdp(codec)) ||
- _rtpRtcpModule->RegisterSendPayload(codec) == -1) {
+ if (STR_CASE_CMP(codec.plname, "CN") == 0) {
+ if (!audio_coding_->RegisterReceiveCodec(codec.pltype,
+ CodecInstToSdp(codec))) {
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::Init() failed to register CN (%d/%d) "
"correctly - 1",
@@ -1041,8 +1066,6 @@ int32_t Channel::Init() {
}
}
}
-
- return 0;
}
void Channel::Terminate() {
@@ -1360,6 +1383,11 @@ int32_t Channel::GetVADStatus(bool& enabledVAD,
return 0;
}
+void Channel::SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) {
+ rtp_payload_registry_->SetAudioReceivePayloads(codecs);
+ audio_coding_->SetReceiveCodecs(codecs);
+}
+
int32_t Channel::SetRecPayloadType(const CodecInst& codec) {
return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec));
}
« 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