OLD | NEW |
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_encoder_factory.h" | 11 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
12 | 12 |
13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_encoder_factory_inter
nal.h" | 13 #include <memory> |
| 14 #include <vector> |
| 15 |
| 16 #include "webrtc/api/audio_codecs/L16/audio_encoder_L16.h" |
| 17 #include "webrtc/api/audio_codecs/audio_encoder_factory_template.h" |
| 18 #include "webrtc/api/audio_codecs/g711/audio_encoder_g711.h" |
| 19 #if WEBRTC_USE_BUILTIN_G722 |
| 20 #include "webrtc/api/audio_codecs/g722/audio_encoder_g722.h" // nogncheck |
| 21 #endif |
| 22 #if WEBRTC_USE_BUILTIN_ILBC |
| 23 #include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc.h" // nogncheck |
| 24 #endif |
| 25 #if WEBRTC_USE_BUILTIN_ISAC_FIX |
| 26 #include "webrtc/api/audio_codecs/isac/audio_encoder_isac_fix.h" // nogncheck |
| 27 #elif WEBRTC_USE_BUILTIN_ISAC_FLOAT |
| 28 #include "webrtc/api/audio_codecs/isac/audio_encoder_isac_float.h" // nogncheck |
| 29 #endif |
| 30 #if WEBRTC_USE_BUILTIN_OPUS |
| 31 #include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h" // nogncheck |
| 32 #endif |
14 | 33 |
15 namespace webrtc { | 34 namespace webrtc { |
16 | 35 |
| 36 namespace { |
| 37 |
| 38 // Modify an audio encoder 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 AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) { |
| 46 // Don't advertise support for anything. |
| 47 } |
| 48 static AudioCodecInfo QueryAudioEncoder(const Config& config) { |
| 49 return T::QueryAudioEncoder(config); |
| 50 } |
| 51 static std::unique_ptr<AudioEncoder> MakeAudioEncoder(const Config& config, |
| 52 int payload_type) { |
| 53 return T::MakeAudioEncoder(config, payload_type); |
| 54 } |
| 55 }; |
| 56 |
| 57 } // namespace |
| 58 |
17 rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() { | 59 rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() { |
18 return CreateBuiltinAudioEncoderFactoryInternal(); | 60 return CreateAudioEncoderFactory< |
| 61 |
| 62 #if WEBRTC_USE_BUILTIN_OPUS |
| 63 AudioEncoderOpus, |
| 64 #endif |
| 65 |
| 66 #if WEBRTC_USE_BUILTIN_ISAC_FIX |
| 67 AudioEncoderIsacFix, |
| 68 #elif WEBRTC_USE_BUILTIN_ISAC_FLOAT |
| 69 AudioEncoderIsacFloat, |
| 70 #endif |
| 71 |
| 72 #if WEBRTC_USE_BUILTIN_G722 |
| 73 AudioEncoderG722, |
| 74 #endif |
| 75 |
| 76 #if WEBRTC_USE_BUILTIN_ILBC |
| 77 AudioEncoderIlbc, |
| 78 #endif |
| 79 |
| 80 AudioEncoderG711, NotAdvertised<AudioEncoderL16>>(); |
19 } | 81 } |
20 | 82 |
21 } // namespace webrtc | 83 } // namespace webrtc |
OLD | NEW |