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

Side by Side Diff: webrtc/media/engine/webrtcmediaengine.cc

Issue 1991233004: Moved creation of AudioDecoderFactory to inside PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@audio-decoder-factory-injections-3
Patch Set: Parental Advisory: Explicit Content Created 4 years, 6 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) 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
(...skipping 11 matching lines...) Expand all
22 namespace cricket { 22 namespace cricket {
23 23
24 class WebRtcMediaEngine2 24 class WebRtcMediaEngine2
25 #ifdef HAVE_WEBRTC_VIDEO 25 #ifdef HAVE_WEBRTC_VIDEO
26 : public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2> { 26 : public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2> {
27 #else 27 #else
28 : public CompositeMediaEngine<WebRtcVoiceEngine, NullWebRtcVideoEngine> { 28 : public CompositeMediaEngine<WebRtcVoiceEngine, NullWebRtcVideoEngine> {
29 #endif 29 #endif
30 public: 30 public:
31 WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm, 31 WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm,
32 WebRtcVideoEncoderFactory* encoder_factory, 32 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
33 WebRtcVideoDecoderFactory* decoder_factory) 33 audio_decoder_factory,
34 WebRtcVideoEncoderFactory* video_encoder_factory,
35 WebRtcVideoDecoderFactory* video_decoder_factory)
34 #ifdef HAVE_WEBRTC_VIDEO 36 #ifdef HAVE_WEBRTC_VIDEO
35 : CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2>(adm) { 37 : CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2>(
38 adm, audio_decoder_factory){
36 #else 39 #else
37 : CompositeMediaEngine<WebRtcVoiceEngine, NullWebRtcVideoEngine>(adm) { 40 : CompositeMediaEngine<WebRtcVoiceEngine, NullWebRtcVideoEngine>(
41 adm, audio_decoder_factory) {
38 #endif 42 #endif
39 video_.SetExternalDecoderFactory(decoder_factory); 43 video_.SetExternalDecoderFactory(video_decoder_factory);
40 video_.SetExternalEncoderFactory(encoder_factory); 44 video_.SetExternalEncoderFactory(video_encoder_factory);
41 } 45 }
42 }; 46 };
43 47
44 } // namespace cricket 48 } // namespace cricket
45 49
46 cricket::MediaEngineInterface* CreateWebRtcMediaEngine( 50 cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
47 webrtc::AudioDeviceModule* adm, 51 webrtc::AudioDeviceModule* adm,
48 cricket::WebRtcVideoEncoderFactory* encoder_factory, 52 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
49 cricket::WebRtcVideoDecoderFactory* decoder_factory) { 53 audio_decoder_factory,
50 return new cricket::WebRtcMediaEngine2(adm, encoder_factory, 54 cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
51 decoder_factory); 55 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) {
56 return new cricket::WebRtcMediaEngine2(
57 adm, audio_decoder_factory, video_encoder_factory, video_decoder_factory);
52 } 58 }
53 59
54 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) { 60 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine) {
55 delete media_engine; 61 delete media_engine;
56 } 62 }
57 63
58 namespace cricket { 64 namespace cricket {
59 65
60 // Used by PeerConnectionFactory to create a media engine passed into 66 // Used by PeerConnectionFactory to create a media engine passed into
61 // ChannelManager. 67 // ChannelManager.
62 MediaEngineInterface* WebRtcMediaEngineFactory::Create( 68 MediaEngineInterface* WebRtcMediaEngineFactory::Create(
63 webrtc::AudioDeviceModule* adm, 69 webrtc::AudioDeviceModule* adm,
64 WebRtcVideoEncoderFactory* encoder_factory, 70 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
65 WebRtcVideoDecoderFactory* decoder_factory) { 71 audio_decoder_factory,
66 return CreateWebRtcMediaEngine(adm, encoder_factory, decoder_factory); 72 WebRtcVideoEncoderFactory* video_encoder_factory,
73 WebRtcVideoDecoderFactory* video_decoder_factory) {
74 return CreateWebRtcMediaEngine(adm, audio_decoder_factory,
75 video_encoder_factory, video_decoder_factory);
67 } 76 }
68 77
69 namespace { 78 namespace {
70 // Remove mutually exclusive extensions with lower priority. 79 // Remove mutually exclusive extensions with lower priority.
71 void DiscardRedundantExtensions( 80 void DiscardRedundantExtensions(
72 std::vector<webrtc::RtpExtension>* extensions, 81 std::vector<webrtc::RtpExtension>* extensions,
73 rtc::ArrayView<const char*> extensions_decreasing_prio) { 82 rtc::ArrayView<const char*> extensions_decreasing_prio) {
74 RTC_DCHECK(extensions); 83 RTC_DCHECK(extensions);
75 bool found = false; 84 bool found = false;
76 for (const char* uri : extensions_decreasing_prio) { 85 for (const char* uri : extensions_decreasing_prio) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 static const char* kBweExtensionPriorities[] = { 149 static const char* kBweExtensionPriorities[] = {
141 webrtc::RtpExtension::kTransportSequenceNumberUri, 150 webrtc::RtpExtension::kTransportSequenceNumberUri,
142 webrtc::RtpExtension::kAbsSendTimeUri, 151 webrtc::RtpExtension::kAbsSendTimeUri,
143 webrtc::RtpExtension::kTimestampOffsetUri}; 152 webrtc::RtpExtension::kTimestampOffsetUri};
144 DiscardRedundantExtensions(&result, kBweExtensionPriorities); 153 DiscardRedundantExtensions(&result, kBweExtensionPriorities);
145 } 154 }
146 155
147 return result; 156 return result;
148 } 157 }
149 } // namespace cricket 158 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcmediaengine.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698