| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 int sample_rate, | 27 int sample_rate, |
| 28 int num_channels) { | 28 int num_channels) { |
| 29 // Create a CodecInst with some fields set. The remaining fields are zeroed, | 29 // Create a CodecInst with some fields set. The remaining fields are zeroed, |
| 30 // but we tell MSan to consider them uninitialized. | 30 // but we tell MSan to consider them uninitialized. |
| 31 CodecInst ci = {0}; | 31 CodecInst ci = {0}; |
| 32 rtc::MsanMarkUninitialized(rtc::MakeArrayView(&ci, 1)); | 32 rtc::MsanMarkUninitialized(rtc::MakeArrayView(&ci, 1)); |
| 33 ci.pltype = payload_type; | 33 ci.pltype = payload_type; |
| 34 strncpy(ci.plname, name, sizeof(ci.plname)); | 34 strncpy(ci.plname, name, sizeof(ci.plname)); |
| 35 ci.plname[sizeof(ci.plname) - 1] = '\0'; | 35 ci.plname[sizeof(ci.plname) - 1] = '\0'; |
| 36 ci.plfreq = sample_rate; | 36 ci.plfreq = sample_rate; |
| 37 ci.channels = rtc::checked_cast<size_t>(num_channels); | 37 ci.channels = rtc::dchecked_cast<size_t>(num_channels); |
| 38 return ci; | 38 return ci; |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 SdpAudioFormat CodecInstToSdp(const CodecInst& ci) { | 43 SdpAudioFormat CodecInstToSdp(const CodecInst& ci) { |
| 44 if (STR_CASE_CMP(ci.plname, "g722") == 0) { | 44 if (STR_CASE_CMP(ci.plname, "g722") == 0) { |
| 45 RTC_CHECK_EQ(16000, ci.plfreq); | 45 RTC_CHECK_EQ(16000, ci.plfreq); |
| 46 RTC_CHECK(ci.channels == 1 || ci.channels == 2); | 46 RTC_CHECK(ci.channels == 1 || ci.channels == 2); |
| 47 return {"g722", 8000, static_cast<int>(ci.channels)}; | 47 return {"g722", 8000, static_cast<int>(ci.channels)}; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return 1; // Default to mono. | 79 return 1; // Default to mono. |
| 80 }(); | 80 }(); |
| 81 return MakeCodecInst(payload_type, "opus", 48000, num_channels); | 81 return MakeCodecInst(payload_type, "opus", 48000, num_channels); |
| 82 } else { | 82 } else { |
| 83 return MakeCodecInst(payload_type, audio_format.name.c_str(), | 83 return MakeCodecInst(payload_type, audio_format.name.c_str(), |
| 84 audio_format.clockrate_hz, audio_format.num_channels); | 84 audio_format.clockrate_hz, audio_format.num_channels); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace webrtc | 88 } // namespace webrtc |
| OLD | NEW |