OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" |
| 12 |
| 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/safe_conversions.h" |
| 15 |
| 16 namespace webrtc { |
| 17 |
| 18 SdpAudioFormat CodecInstToSdp(const CodecInst& ci) { |
| 19 if (STR_CASE_CMP(ci.plname, "g722") == 0 && ci.plfreq == 16000) { |
| 20 RTC_CHECK(ci.channels == 1 || ci.channels == 2); |
| 21 return {"g722", 8000, static_cast<int>(ci.channels)}; |
| 22 } else if (STR_CASE_CMP(ci.plname, "opus") == 0 && ci.plfreq == 48000) { |
| 23 RTC_CHECK(ci.channels == 1 || ci.channels == 2); |
| 24 return {"opus", 48000, 2, {{"stereo", ci.channels == 1 ? "0" : "1"}}}; |
| 25 } else { |
| 26 return {ci.plname, ci.plfreq, rtc::checked_cast<int>(ci.channels)}; |
| 27 } |
| 28 } |
| 29 |
| 30 } // namespace webrtc |
OLD | NEW |