| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/audio_coding/codecs/audio_format.h" | 11 #include "webrtc/modules/audio_coding/codecs/audio_format.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" |
| 13 #include "webrtc/common_types.h" | 14 #include "webrtc/common_types.h" |
| 14 | 15 |
| 15 namespace webrtc { | 16 namespace webrtc { |
| 16 | 17 |
| 17 SdpAudioFormat::SdpAudioFormat(const SdpAudioFormat&) = default; | 18 SdpAudioFormat::SdpAudioFormat(const SdpAudioFormat&) = default; |
| 18 SdpAudioFormat::SdpAudioFormat(SdpAudioFormat&&) = default; | 19 SdpAudioFormat::SdpAudioFormat(SdpAudioFormat&&) = default; |
| 19 | 20 |
| 20 SdpAudioFormat::SdpAudioFormat(const char* name, | 21 SdpAudioFormat::SdpAudioFormat(const char* name, |
| 21 int clockrate_hz, | 22 int clockrate_hz, |
| 22 int num_channels) | 23 int num_channels) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 os << ", parameters: {"; | 57 os << ", parameters: {"; |
| 57 const char* sep = ""; | 58 const char* sep = ""; |
| 58 for (const auto& kv : saf.parameters) { | 59 for (const auto& kv : saf.parameters) { |
| 59 os << sep << kv.first << ": " << kv.second; | 60 os << sep << kv.first << ": " << kv.second; |
| 60 sep = ", "; | 61 sep = ", "; |
| 61 } | 62 } |
| 62 os << "}}"; | 63 os << "}}"; |
| 63 return os; | 64 return os; |
| 64 } | 65 } |
| 65 | 66 |
| 67 SdpAudioFormat CodecInstToSdp(const CodecInst& ci) { |
| 68 if (STR_CASE_CMP(ci.plname, "g722") == 0 && ci.plfreq == 16000) { |
| 69 RTC_CHECK(ci.channels == 1 || ci.channels == 2); |
| 70 return {"g722", 8000, ci.channels}; |
| 71 } else if (STR_CASE_CMP(ci.plname, "opus") == 0 && ci.plfreq == 48000) { |
| 72 RTC_CHECK(ci.channels == 1 || ci.channels == 2); |
| 73 return {"opus", 48000, 2, {{"stereo", ci.channels == 1 ? "0" : "1"}}}; |
| 74 } else { |
| 75 return {ci.plname, ci.plfreq, ci.channels}; |
| 76 } |
| 77 } |
| 78 |
| 66 } // namespace webrtc | 79 } // namespace webrtc |
| OLD | NEW |