Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/rent_a_codec.h

Issue 1432553007: Rename Maybe to Optional (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: a -> an Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_
13 13
14 #include <stddef.h> 14 #include <stddef.h>
15 15
16 #include "webrtc/base/array_view.h" 16 #include "webrtc/base/array_view.h"
17 #include "webrtc/base/maybe.h" 17 #include "webrtc/base/optional.h"
18 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 struct CodecInst; 22 struct CodecInst;
23 23
24 namespace acm2 { 24 namespace acm2 {
25 25
26 class RentACodec { 26 class RentACodec {
27 public: 27 public:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 kDecoderCNGswb48kHz, 124 kDecoderCNGswb48kHz,
125 kDecoderArbitrary, 125 kDecoderArbitrary,
126 kDecoderOpus, 126 kDecoderOpus,
127 kDecoderOpus_2ch, 127 kDecoderOpus_2ch,
128 }; 128 };
129 129
130 static inline size_t NumberOfCodecs() { 130 static inline size_t NumberOfCodecs() {
131 return static_cast<size_t>(CodecId::kNumCodecs); 131 return static_cast<size_t>(CodecId::kNumCodecs);
132 } 132 }
133 133
134 static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) { 134 static inline rtc::Optional<int> CodecIndexFromId(CodecId codec_id) {
135 const int i = static_cast<int>(codec_id); 135 const int i = static_cast<int>(codec_id);
136 return i >= 0 && i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i) 136 return i >= 0 && i < static_cast<int>(NumberOfCodecs())
137 : rtc::Maybe<int>(); 137 ? rtc::Optional<int>(i)
138 : rtc::Optional<int>();
138 } 139 }
139 140
140 static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) { 141 static inline rtc::Optional<CodecId> CodecIdFromIndex(int codec_index) {
141 return static_cast<size_t>(codec_index) < NumberOfCodecs() 142 return static_cast<size_t>(codec_index) < NumberOfCodecs()
142 ? rtc::Maybe<RentACodec::CodecId>( 143 ? rtc::Optional<RentACodec::CodecId>(
143 static_cast<RentACodec::CodecId>(codec_index)) 144 static_cast<RentACodec::CodecId>(codec_index))
144 : rtc::Maybe<RentACodec::CodecId>(); 145 : rtc::Optional<RentACodec::CodecId>();
145 } 146 }
146 147
147 static rtc::Maybe<CodecId> CodecIdByParams(const char* payload_name, 148 static rtc::Optional<CodecId> CodecIdByParams(const char* payload_name,
148 int sampling_freq_hz, 149 int sampling_freq_hz,
149 int channels); 150 int channels);
150 static rtc::Maybe<CodecInst> CodecInstById(CodecId codec_id); 151 static rtc::Optional<CodecInst> CodecInstById(CodecId codec_id);
151 static rtc::Maybe<CodecId> CodecIdByInst(const CodecInst& codec_inst); 152 static rtc::Optional<CodecId> CodecIdByInst(const CodecInst& codec_inst);
152 static rtc::Maybe<CodecInst> CodecInstByParams(const char* payload_name, 153 static rtc::Optional<CodecInst> CodecInstByParams(const char* payload_name,
153 int sampling_freq_hz, 154 int sampling_freq_hz,
154 int channels); 155 int channels);
155 static bool IsCodecValid(const CodecInst& codec_inst); 156 static bool IsCodecValid(const CodecInst& codec_inst);
156 157
157 static inline bool IsPayloadTypeValid(int payload_type) { 158 static inline bool IsPayloadTypeValid(int payload_type) {
158 return payload_type >= 0 && payload_type <= 127; 159 return payload_type >= 0 && payload_type <= 127;
159 } 160 }
160 161
161 static rtc::ArrayView<const CodecInst> Database(); 162 static rtc::ArrayView<const CodecInst> Database();
162 163
163 static rtc::Maybe<bool> IsSupportedNumChannels(CodecId codec_id, 164 static rtc::Optional<bool> IsSupportedNumChannels(CodecId codec_id,
164 int num_channels); 165 int num_channels);
165 166
166 static rtc::Maybe<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, 167 static rtc::Optional<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id,
167 int num_channels); 168 int num_channels);
168 }; 169 };
169 170
170 } // namespace acm2 171 } // namespace acm2
171 } // namespace webrtc 172 } // namespace webrtc
172 173
173 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ 174 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698