OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 kNone = -1 | 97 kNone = -1 |
98 }; | 98 }; |
99 | 99 |
100 static inline size_t NumberOfCodecs() { | 100 static inline size_t NumberOfCodecs() { |
101 return static_cast<size_t>(CodecId::kNumCodecs); | 101 return static_cast<size_t>(CodecId::kNumCodecs); |
102 } | 102 } |
103 | 103 |
104 static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) { | 104 static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) { |
105 const int i = static_cast<int>(codec_id); | 105 const int i = static_cast<int>(codec_id); |
106 return i < static_cast<int>(NumberOfCodecs()) ? i : rtc::Maybe<int>(); | 106 return i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i) |
| 107 : rtc::Maybe<int>(); |
107 } | 108 } |
108 | 109 |
109 static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) { | 110 static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) { |
110 return static_cast<size_t>(codec_index) < NumberOfCodecs() | 111 return static_cast<size_t>(codec_index) < NumberOfCodecs() |
111 ? static_cast<RentACodec::CodecId>(codec_index) | 112 ? rtc::Maybe<RentACodec::CodecId>( |
| 113 static_cast<RentACodec::CodecId>(codec_index)) |
112 : rtc::Maybe<RentACodec::CodecId>(); | 114 : rtc::Maybe<RentACodec::CodecId>(); |
113 } | 115 } |
114 | 116 |
115 static rtc::Maybe<CodecId> CodecIdByParams(const char* payload_name, | 117 static rtc::Maybe<CodecId> CodecIdByParams(const char* payload_name, |
116 int sampling_freq_hz, | 118 int sampling_freq_hz, |
117 int channels); | 119 int channels); |
118 static rtc::Maybe<CodecInst> CodecInstById(CodecId codec_id); | 120 static rtc::Maybe<CodecInst> CodecInstById(CodecId codec_id); |
119 static rtc::Maybe<CodecInst> CodecInstByParams(const char* payload_name, | 121 static rtc::Maybe<CodecInst> CodecInstByParams(const char* payload_name, |
120 int sampling_freq_hz, | 122 int sampling_freq_hz, |
121 int channels); | 123 int channels); |
122 static bool IsCodecValid(const CodecInst& codec_inst); | 124 static bool IsCodecValid(const CodecInst& codec_inst); |
123 static rtc::ArrayView<const CodecInst> Database(); | 125 static rtc::ArrayView<const CodecInst> Database(); |
124 }; | 126 }; |
125 | 127 |
126 } // namespace acm2 | 128 } // namespace acm2 |
127 } // namespace webrtc | 129 } // namespace webrtc |
128 | 130 |
129 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 131 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
OLD | NEW |