OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 "media/engine/webrtcmediaengine.h" | 11 #include "media/engine/webrtcmediaengine.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "api/audio_codecs/builtin_audio_decoder_factory.h" | 15 #include "api/audio_codecs/builtin_audio_decoder_factory.h" |
16 #include "api/audio_codecs/builtin_audio_encoder_factory.h" | 16 #include "api/audio_codecs/builtin_audio_encoder_factory.h" |
| 17 #include "api/video_codecs/video_decoder_factory.h" |
| 18 #include "api/video_codecs/video_encoder_factory.h" |
17 #include "media/engine/webrtcvoiceengine.h" | 19 #include "media/engine/webrtcvoiceengine.h" |
18 | 20 |
19 #ifdef HAVE_WEBRTC_VIDEO | 21 #ifdef HAVE_WEBRTC_VIDEO |
20 #include "media/engine/webrtcvideoengine.h" | 22 #include "media/engine/webrtcvideoengine.h" |
21 #else | 23 #else |
22 #include "media/engine/nullwebrtcvideoengine.h" | 24 #include "media/engine/nullwebrtcvideoengine.h" |
23 #endif | 25 #endif |
24 | 26 |
25 namespace cricket { | 27 namespace cricket { |
26 | 28 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 audio_decoder_factory, | 116 audio_decoder_factory, |
115 WebRtcVideoEncoderFactory* video_encoder_factory, | 117 WebRtcVideoEncoderFactory* video_encoder_factory, |
116 WebRtcVideoDecoderFactory* video_decoder_factory, | 118 WebRtcVideoDecoderFactory* video_decoder_factory, |
117 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, | 119 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
118 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing) { | 120 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing) { |
119 return CreateWebRtcMediaEngine( | 121 return CreateWebRtcMediaEngine( |
120 adm, audio_encoder_factory, audio_decoder_factory, video_encoder_factory, | 122 adm, audio_encoder_factory, audio_decoder_factory, video_encoder_factory, |
121 video_decoder_factory, audio_mixer, audio_processing); | 123 video_decoder_factory, audio_mixer, audio_processing); |
122 } | 124 } |
123 | 125 |
| 126 std::unique_ptr<MediaEngineInterface> WebRtcMediaEngineFactory::Create( |
| 127 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm, |
| 128 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, |
| 129 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory, |
| 130 std::unique_ptr<webrtc::VideoEncoderFactory> video_encoder_factory, |
| 131 std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory, |
| 132 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
| 133 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing) { |
| 134 #ifdef HAVE_WEBRTC_VIDEO |
| 135 typedef WebRtcVideoEngine VideoEngine; |
| 136 std::tuple<std::unique_ptr<webrtc::VideoEncoderFactory>, |
| 137 std::unique_ptr<webrtc::VideoDecoderFactory>> |
| 138 video_args(std::move(video_encoder_factory), |
| 139 std::move(video_decoder_factory)); |
| 140 #else |
| 141 typedef NullWebRtcVideoEngine VideoEngine; |
| 142 std::tuple<> video_args; |
| 143 #endif |
| 144 return std::unique_ptr<MediaEngineInterface>( |
| 145 new CompositeMediaEngine<WebRtcVoiceEngine, VideoEngine>( |
| 146 std::forward_as_tuple(adm, audio_encoder_factory, |
| 147 audio_decoder_factory, audio_mixer, |
| 148 audio_processing), |
| 149 std::move(video_args))); |
| 150 } |
| 151 |
124 namespace { | 152 namespace { |
125 // Remove mutually exclusive extensions with lower priority. | 153 // Remove mutually exclusive extensions with lower priority. |
126 void DiscardRedundantExtensions( | 154 void DiscardRedundantExtensions( |
127 std::vector<webrtc::RtpExtension>* extensions, | 155 std::vector<webrtc::RtpExtension>* extensions, |
128 rtc::ArrayView<const char* const> extensions_decreasing_prio) { | 156 rtc::ArrayView<const char* const> extensions_decreasing_prio) { |
129 RTC_DCHECK(extensions); | 157 RTC_DCHECK(extensions); |
130 bool found = false; | 158 bool found = false; |
131 for (const char* uri : extensions_decreasing_prio) { | 159 for (const char* uri : extensions_decreasing_prio) { |
132 auto it = std::find_if( | 160 auto it = std::find_if( |
133 extensions->begin(), extensions->end(), | 161 extensions->begin(), extensions->end(), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 253 } |
226 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && | 254 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && |
227 bitrate_kbps > 0) { | 255 bitrate_kbps > 0) { |
228 config.max_bitrate_bps = bitrate_kbps * 1000; | 256 config.max_bitrate_bps = bitrate_kbps * 1000; |
229 } else { | 257 } else { |
230 config.max_bitrate_bps = -1; | 258 config.max_bitrate_bps = -1; |
231 } | 259 } |
232 return config; | 260 return config; |
233 } | 261 } |
234 } // namespace cricket | 262 } // namespace cricket |
OLD | NEW |