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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decoder_database.cc

Issue 2071003003: Imported Optional from Chromium with some modifications. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added an empty member to the OptionalStorage union, to make the union always initializable. Created 4 years, 5 months 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
« no previous file with comments | « webrtc/base/template_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 RTC_DCHECK(audio_format_); 58 RTC_DCHECK(audio_format_);
59 if (!decoder_) { 59 if (!decoder_) {
60 decoder_ = factory->MakeAudioDecoder(*audio_format_); 60 decoder_ = factory->MakeAudioDecoder(*audio_format_);
61 } 61 }
62 RTC_DCHECK(decoder_) << "Failed to create: " << *audio_format_; 62 RTC_DCHECK(decoder_) << "Failed to create: " << *audio_format_;
63 return decoder_.get(); 63 return decoder_.get();
64 } 64 }
65 65
66 rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder> 66 rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder>
67 DecoderDatabase::DecoderInfo::CngDecoder::Create(NetEqDecoder ct) { 67 DecoderDatabase::DecoderInfo::CngDecoder::Create(NetEqDecoder ct) {
68 const auto cng = [](int sample_rate_hz) {
69 return rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder>(
70 {sample_rate_hz});
71 };
72 switch (ct) { 68 switch (ct) {
73 case NetEqDecoder::kDecoderCNGnb: 69 case NetEqDecoder::kDecoderCNGnb:
74 return cng(8000); 70 return CngDecoder{8000};
75 case NetEqDecoder::kDecoderCNGwb: 71 case NetEqDecoder::kDecoderCNGwb:
76 return cng(16000); 72 return CngDecoder{16000};
77 case NetEqDecoder::kDecoderCNGswb32kHz: 73 case NetEqDecoder::kDecoderCNGswb32kHz:
78 return cng(32000); 74 return CngDecoder{32000};
79 case NetEqDecoder::kDecoderCNGswb48kHz: 75 case NetEqDecoder::kDecoderCNGswb48kHz:
80 return cng(48000); 76 return CngDecoder{48000};
81 default: 77 default:
82 return rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder>(); 78 return rtc::nullopt;
83 } 79 }
84 } 80 }
85 81
86 bool DecoderDatabase::Empty() const { return decoders_.empty(); } 82 bool DecoderDatabase::Empty() const { return decoders_.empty(); }
87 83
88 int DecoderDatabase::Size() const { return static_cast<int>(decoders_.size()); } 84 int DecoderDatabase::Size() const { return static_cast<int>(decoders_.size()); }
89 85
90 void DecoderDatabase::Reset() { 86 void DecoderDatabase::Reset() {
91 decoders_.clear(); 87 decoders_.clear();
92 active_decoder_type_ = -1; 88 active_decoder_type_ = -1;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " 292 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type "
297 << static_cast<int>((*it)->header.payloadType); 293 << static_cast<int>((*it)->header.payloadType);
298 return kDecoderNotFound; 294 return kDecoderNotFound;
299 } 295 }
300 } 296 }
301 return kOK; 297 return kOK;
302 } 298 }
303 299
304 300
305 } // namespace webrtc 301 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/template_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698