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

Side by Side Diff: webrtc/api/audio_codecs/builtin_audio_decoder_factory.cc

Issue 2997713002: Reimplement the builtin audio codec factories using the new stuff in api/ (Closed)
Patch Set: . Created 3 years, 4 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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/builtin_audio_decoder_factory.h" 11 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
12 12
13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_inter nal.h" 13 #include <memory>
14 #include <vector>
15
16 #include "webrtc/api/audio_codecs/L16/audio_decoder_L16.h"
17 #include "webrtc/api/audio_codecs/audio_decoder_factory_template.h"
18 #include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h"
19 #if WEBRTC_USE_BUILTIN_G722
20 #include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h" // nogncheck
21 #endif
22 #if WEBRTC_USE_BUILTIN_ILBC
23 #include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h" // nogncheck
24 #endif
25 #if WEBRTC_USE_BUILTIN_ISAC_FIX
26 #include "webrtc/api/audio_codecs/isac/audio_decoder_isac_fix.h" // nogncheck
27 #elif WEBRTC_USE_BUILTIN_ISAC_FLOAT
28 #include "webrtc/api/audio_codecs/isac/audio_decoder_isac_float.h" // nogncheck
29 #endif
30 #if WEBRTC_USE_BUILTIN_OPUS
31 #include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck
32 #endif
14 33
15 namespace webrtc { 34 namespace webrtc {
16 35
36 namespace {
37
38 // Modify an audio decoder to not advertise support for anything.
39 template <typename T>
40 struct NotAdvertised {
41 using Config = typename T::Config;
42 static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
43 return T::SdpToConfig(audio_format);
44 }
45 static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
46 // Don't advertise support for anything.
47 }
48 static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const Config& config) {
49 return T::MakeAudioDecoder(config);
50 }
51 };
52
53 } // namespace
54
17 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() { 55 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() {
18 return CreateBuiltinAudioDecoderFactoryInternal(); 56 return CreateAudioDecoderFactory<
57
58 #if WEBRTC_USE_BUILTIN_OPUS
59 AudioDecoderOpus,
60 #endif
61
62 #if WEBRTC_USE_BUILTIN_ISAC_FIX
63 AudioDecoderIsacFix,
64 #elif WEBRTC_USE_BUILTIN_ISAC_FLOAT
65 AudioDecoderIsacFloat,
66 #endif
67
68 #if WEBRTC_USE_BUILTIN_G722
69 AudioDecoderG722,
70 #endif
71
72 #if WEBRTC_USE_BUILTIN_ILBC
73 AudioDecoderIlbc,
74 #endif
75
76 AudioDecoderG711, NotAdvertised<AudioDecoderL16>>();
ossu 2017/08/22 12:29:16 Neat! Not advertising L16 in our builtin factory
kwiberg-webrtc 2017/08/22 12:40:35 Yes, I realized that this behavior was probably or
19 } 77 }
20 78
21 } // namespace webrtc 79 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/audio_codecs/BUILD.gn ('k') | webrtc/api/audio_codecs/builtin_audio_encoder_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698