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

Unified Diff: webrtc/modules/audio_coding/codecs/audio_format.cc

Issue 2388153004: Stop using old AudioCodingModule::RegisterReceiveCodec overloads (Closed)
Patch Set: Created 4 years, 2 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/codecs/audio_format.cc
diff --git a/webrtc/modules/audio_coding/codecs/audio_format.cc b/webrtc/modules/audio_coding/codecs/audio_format.cc
index ebd7cb030b4fdbcec19eaef2cbc09cff856ec376..a43203440bfdc3f24e152d80639441dcff79900f 100644
--- a/webrtc/modules/audio_coding/codecs/audio_format.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_format.cc
@@ -10,6 +10,7 @@
#include "webrtc/modules/audio_coding/codecs/audio_format.h"
+#include "webrtc/base/checks.h"
#include "webrtc/common_types.h"
namespace webrtc {
@@ -63,4 +64,16 @@ std::ostream& operator<<(std::ostream& os, const SdpAudioFormat& saf) {
return os;
}
+SdpAudioFormat CodecInstToSdp(const CodecInst& ci) {
+ if (STR_CASE_CMP(ci.plname, "g722") == 0 && ci.plfreq == 16000) {
+ RTC_CHECK(ci.channels == 1 || ci.channels == 2);
+ return {"g722", 8000, ci.channels};
+ } else if (STR_CASE_CMP(ci.plname, "opus") == 0 && ci.plfreq == 48000) {
+ RTC_CHECK(ci.channels == 1 || ci.channels == 2);
+ return {"opus", 48000, 2, {{"stereo", ci.channels == 1 ? "0" : "1"}}};
+ } else {
+ return {ci.plname, ci.plfreq, ci.channels};
+ }
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698