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 |