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

Unified Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 2772043002: Revert of WebRtcVoiceMediaChannel::AddRecvStream: Don't call SetRecPayloadType (Closed)
Patch Set: 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
Index: webrtc/modules/audio_coding/acm2/audio_coding_module.cc
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
index bc814f6d6fac682f146302e68f09e4173ef6b94b..daeea3577e23a854d26f9b702c6d84f1c5ec989d 100644
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
@@ -120,8 +120,6 @@
// Get current playout frequency.
int PlayoutFrequency() const override;
-
- void SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) override;
bool RegisterReceiveCodec(int rtp_payload_type,
const SdpAudioFormat& audio_format) override;
@@ -318,6 +316,16 @@
"WebRTC.Audio.Encoder.CodecType", static_cast<int>(codec_type),
static_cast<int>(
webrtc::AudioEncoder::CodecType::kMaxLoggedAudioCodecTypes));
+}
+
+// TODO(turajs): the same functionality is used in NetEq. If both classes
+// need them, make it a static function in ACMCodecDB.
+bool IsCodecRED(const CodecInst& codec) {
+ return (STR_CASE_CMP(codec.plname, "RED") == 0);
+}
+
+bool IsCodecCN(const CodecInst& codec) {
+ return (STR_CASE_CMP(codec.plname, "CN") == 0);
}
// Stereo-to-mono can be used as in-place.
@@ -948,6 +956,19 @@
receiver_.SetMaximumDelay(0);
receiver_.FlushBuffers();
+ // Register RED and CN.
+ auto db = acm2::RentACodec::Database();
+ for (size_t i = 0; i < db.size(); i++) {
+ if (IsCodecRED(db[i]) || IsCodecCN(db[i])) {
+ if (receiver_.AddCodec(static_cast<int>(i),
+ static_cast<uint8_t>(db[i].pltype), 1,
+ db[i].plfreq, nullptr, db[i].plname) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
+ "Cannot register master codec.");
+ return -1;
+ }
+ }
+ }
receiver_initialized_ = true;
return 0;
}
@@ -964,12 +985,6 @@
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
"PlayoutFrequency()");
return receiver_.last_output_sample_rate_hz();
-}
-
-void AudioCodingModuleImpl::SetReceiveCodecs(
- const std::map<int, SdpAudioFormat>& codecs) {
- rtc::CritScope lock(&acm_crit_sect_);
- receiver_.SetCodecs(codecs);
}
bool AudioCodingModuleImpl::RegisterReceiveCodec(
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_receiver.cc ('k') | webrtc/modules/audio_coding/include/audio_coding_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698