| 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/api/audio_codecs/audio_format.h" | 11 #include "webrtc/api/audio_codecs/audio_format.h" |
| 12 | 12 |
| 13 #include "webrtc/common_types.h" | 13 #include "webrtc/common_types.h" |
| 14 | 14 |
| 15 namespace webrtc { | 15 namespace webrtc { |
| 16 | 16 |
| 17 SdpAudioFormat::SdpAudioFormat(const SdpAudioFormat&) = default; | 17 SdpAudioFormat::SdpAudioFormat(const SdpAudioFormat&) = default; |
| 18 SdpAudioFormat::SdpAudioFormat(SdpAudioFormat&&) = default; | 18 SdpAudioFormat::SdpAudioFormat(SdpAudioFormat&&) = default; |
| 19 | 19 |
| 20 SdpAudioFormat::SdpAudioFormat(const char* name, | 20 SdpAudioFormat::SdpAudioFormat(const char* name, |
| 21 int clockrate_hz, | 21 int clockrate_hz, |
| 22 int num_channels) | 22 size_t num_channels) |
| 23 : name(name), clockrate_hz(clockrate_hz), num_channels(num_channels) {} | 23 : name(name), clockrate_hz(clockrate_hz), num_channels(num_channels) {} |
| 24 | 24 |
| 25 SdpAudioFormat::SdpAudioFormat(const std::string& name, | 25 SdpAudioFormat::SdpAudioFormat(const std::string& name, |
| 26 int clockrate_hz, | 26 int clockrate_hz, |
| 27 int num_channels) | 27 size_t num_channels) |
| 28 : name(name), clockrate_hz(clockrate_hz), num_channels(num_channels) {} | 28 : name(name), clockrate_hz(clockrate_hz), num_channels(num_channels) {} |
| 29 | 29 |
| 30 SdpAudioFormat::SdpAudioFormat(const char* name, | 30 SdpAudioFormat::SdpAudioFormat(const char* name, |
| 31 int clockrate_hz, | 31 int clockrate_hz, |
| 32 int num_channels, | 32 size_t num_channels, |
| 33 const Parameters& param) | 33 const Parameters& param) |
| 34 : name(name), | 34 : name(name), |
| 35 clockrate_hz(clockrate_hz), | 35 clockrate_hz(clockrate_hz), |
| 36 num_channels(num_channels), | 36 num_channels(num_channels), |
| 37 parameters(param) {} | 37 parameters(param) {} |
| 38 | 38 |
| 39 SdpAudioFormat::SdpAudioFormat(const std::string& name, | 39 SdpAudioFormat::SdpAudioFormat(const std::string& name, |
| 40 int clockrate_hz, | 40 int clockrate_hz, |
| 41 int num_channels, | 41 size_t num_channels, |
| 42 const Parameters& param) | 42 const Parameters& param) |
| 43 : name(name), | 43 : name(name), |
| 44 clockrate_hz(clockrate_hz), | 44 clockrate_hz(clockrate_hz), |
| 45 num_channels(num_channels), | 45 num_channels(num_channels), |
| 46 parameters(param) {} | 46 parameters(param) {} |
| 47 | 47 |
| 48 SdpAudioFormat::~SdpAudioFormat() = default; | 48 SdpAudioFormat::~SdpAudioFormat() = default; |
| 49 SdpAudioFormat& SdpAudioFormat::operator=(const SdpAudioFormat&) = default; | 49 SdpAudioFormat& SdpAudioFormat::operator=(const SdpAudioFormat&) = default; |
| 50 SdpAudioFormat& SdpAudioFormat::operator=(SdpAudioFormat&&) = default; | 50 SdpAudioFormat& SdpAudioFormat::operator=(SdpAudioFormat&&) = default; |
| 51 | 51 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 70 os << ", parameters: {"; | 70 os << ", parameters: {"; |
| 71 const char* sep = ""; | 71 const char* sep = ""; |
| 72 for (const auto& kv : saf.parameters) { | 72 for (const auto& kv : saf.parameters) { |
| 73 os << sep << kv.first << ": " << kv.second; | 73 os << sep << kv.first << ": " << kv.second; |
| 74 sep = ", "; | 74 sep = ", "; |
| 75 } | 75 } |
| 76 os << "}}"; | 76 os << "}}"; |
| 77 return os; | 77 return os; |
| 78 } | 78 } |
| 79 | 79 |
| 80 AudioCodecSpec::AudioCodecSpec(const SdpAudioFormat& format) : format(format) {} | 80 AudioCodecInfo::AudioCodecInfo(int sample_rate_hz, |
| 81 size_t num_channels, |
| 82 int bitrate_bps) |
| 83 : AudioCodecInfo(sample_rate_hz, |
| 84 num_channels, |
| 85 bitrate_bps, |
| 86 bitrate_bps, |
| 87 bitrate_bps) {} |
| 81 | 88 |
| 82 AudioCodecSpec::AudioCodecSpec(SdpAudioFormat&& format) | 89 AudioCodecInfo::AudioCodecInfo(int sample_rate_hz, |
| 83 : format(std::move(format)) {} | 90 size_t num_channels, |
| 91 int default_bitrate_bps, |
| 92 int min_bitrate_bps, |
| 93 int max_bitrate_bps) |
| 94 : sample_rate_hz(sample_rate_hz), |
| 95 num_channels(num_channels), |
| 96 default_bitrate_bps(default_bitrate_bps), |
| 97 min_bitrate_bps(min_bitrate_bps), |
| 98 max_bitrate_bps(max_bitrate_bps) { |
| 99 RTC_DCHECK_GT(sample_rate_hz, 0); |
| 100 RTC_DCHECK_GT(num_channels, 0); |
| 101 RTC_DCHECK_GE(min_bitrate_bps, 0); |
| 102 RTC_DCHECK_LE(min_bitrate_bps, default_bitrate_bps); |
| 103 RTC_DCHECK_GE(max_bitrate_bps, default_bitrate_bps); |
| 104 } |
| 84 | 105 |
| 85 } // namespace webrtc | 106 } // namespace webrtc |
| OLD | NEW |