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

Side by Side Diff: webrtc/modules/audio_coding/acm2/rent_a_codec.cc

Issue 1928293002: NetEq: Use a BuiltinAudioDecoderFactory to create decoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
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
(...skipping 29 matching lines...) Expand all
40 #include "webrtc/modules/audio_coding/acm2/acm_codec_database.h" 40 #include "webrtc/modules/audio_coding/acm2/acm_codec_database.h"
41 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" 41 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
42 42
43 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC) 43 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
44 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" 44 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
45 #endif 45 #endif
46 46
47 namespace webrtc { 47 namespace webrtc {
48 namespace acm2 { 48 namespace acm2 {
49 49
50 rtc::Optional<SdpAudioFormat> RentACodec::NetEqDecoderToSdpAudioFormat(
51 NetEqDecoder nd) {
52 switch (nd) {
53 case NetEqDecoder::kDecoderPCMu:
54 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcmu", 8000, 1));
55 case NetEqDecoder::kDecoderPCMa:
56 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcma", 8000, 1));
57 case NetEqDecoder::kDecoderPCMu_2ch:
58 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcmu", 8000, 2));
59 case NetEqDecoder::kDecoderPCMa_2ch:
60 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcma", 8000, 2));
61 case NetEqDecoder::kDecoderILBC:
62 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("ilbc", 8000, 1));
63 case NetEqDecoder::kDecoderISAC:
64 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("isac", 16000, 1));
65 case NetEqDecoder::kDecoderISACswb:
66 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("isac", 32000, 1));
67 case NetEqDecoder::kDecoderPCM16B:
68 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 1));
69 case NetEqDecoder::kDecoderPCM16Bwb:
70 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 16000, 1));
71 case NetEqDecoder::kDecoderPCM16Bswb32kHz:
72 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 32000, 1));
73 case NetEqDecoder::kDecoderPCM16Bswb48kHz:
74 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 48000, 1));
75 case NetEqDecoder::kDecoderPCM16B_2ch:
76 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 2));
77 case NetEqDecoder::kDecoderPCM16Bwb_2ch:
78 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 16000, 2));
79 case NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch:
80 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 32000, 2));
81 case NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch:
82 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 48000, 2));
83 case NetEqDecoder::kDecoderPCM16B_5ch:
84 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 5));
85 case NetEqDecoder::kDecoderG722:
86 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("g722", 8000, 1));
87 case NetEqDecoder::kDecoderG722_2ch:
88 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("g722", 8000, 2));
89 case NetEqDecoder::kDecoderOpus:
90 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("opus", 48000, 1));
91 case NetEqDecoder::kDecoderOpus_2ch:
92 return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("opus", 48000, 2));
ossu 2016/04/29 12:21:33 Opus is weird and always wants to have a channel c
kwiberg-webrtc 2016/04/29 23:10:13 I was hoping to be able to postpone the introducti
ossu 2016/05/02 10:59:40 Might as well do it "the right (wrong) way" from t
kwiberg-webrtc 2016/05/02 20:20:00 Done.
93
94 default:
95 return rtc::Optional<SdpAudioFormat>();
96 }
97 }
98
50 rtc::Optional<RentACodec::CodecId> RentACodec::CodecIdByParams( 99 rtc::Optional<RentACodec::CodecId> RentACodec::CodecIdByParams(
51 const char* payload_name, 100 const char* payload_name,
52 int sampling_freq_hz, 101 int sampling_freq_hz,
53 size_t channels) { 102 size_t channels) {
54 return CodecIdFromIndex( 103 return CodecIdFromIndex(
55 ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels)); 104 ACMCodecDB::CodecId(payload_name, sampling_freq_hz, channels));
56 } 105 }
57 106
58 rtc::Optional<CodecInst> RentACodec::CodecInstById(CodecId codec_id) { 107 rtc::Optional<CodecInst> RentACodec::CodecInstById(CodecId codec_id) {
59 rtc::Optional<int> mi = CodecIndexFromId(codec_id); 108 rtc::Optional<int> mi = CodecIndexFromId(codec_id);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 352 }
304 return encoder_stack; 353 return encoder_stack;
305 } 354 }
306 355
307 std::unique_ptr<AudioDecoder> RentACodec::RentIsacDecoder() { 356 std::unique_ptr<AudioDecoder> RentACodec::RentIsacDecoder() {
308 return CreateIsacDecoder(isac_bandwidth_info_); 357 return CreateIsacDecoder(isac_bandwidth_info_);
309 } 358 }
310 359
311 } // namespace acm2 360 } // namespace acm2
312 } // namespace webrtc 361 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698