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

Side by Side Diff: webrtc/media/base/mediaengine.h

Issue 3008043002: Simplify passing video codec factories in media engine (Closed)
Patch Set: Created 3 years, 3 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
« no previous file with comments | « webrtc/media/base/fakemediaengine.h ('k') | webrtc/media/base/videoengine_unittest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // reset to the default behavior. 102 // reset to the default behavior.
103 static MediaEngineCreateFunction SetCreateFunction( 103 static MediaEngineCreateFunction SetCreateFunction(
104 MediaEngineCreateFunction function); 104 MediaEngineCreateFunction function);
105 private: 105 private:
106 static MediaEngineCreateFunction create_function_; 106 static MediaEngineCreateFunction create_function_;
107 }; 107 };
108 #endif 108 #endif
109 109
110 // CompositeMediaEngine constructs a MediaEngine from separate 110 // CompositeMediaEngine constructs a MediaEngine from separate
111 // voice and video engine classes. 111 // voice and video engine classes.
112 template<class VOICE, class VIDEO> 112 template <class VOICE, class VIDEO>
113 class CompositeMediaEngine : public MediaEngineInterface { 113 class CompositeMediaEngine : public MediaEngineInterface {
114 public: 114 public:
115 CompositeMediaEngine( 115 template <class... Args1, class... Args2>
116 webrtc::AudioDeviceModule* adm, 116 CompositeMediaEngine(std::tuple<Args1...> first_args,
117 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& 117 std::tuple<Args2...> second_args)
118 audio_encoder_factory, 118 : engines_(std::piecewise_construct,
119 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& 119 std::move(first_args),
120 audio_decoder_factory, 120 std::move(second_args)) {}
121 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, 121
122 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing)
123 : voice_(adm,
124 audio_encoder_factory,
125 audio_decoder_factory,
126 audio_mixer,
127 audio_processing) {}
128 virtual ~CompositeMediaEngine() {} 122 virtual ~CompositeMediaEngine() {}
129 virtual bool Init() { 123 virtual bool Init() {
130 voice_.Init(); 124 voice().Init();
131 video_.Init();
132 return true; 125 return true;
133 } 126 }
134 127
135 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { 128 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const {
136 return voice_.GetAudioState(); 129 return voice().GetAudioState();
137 } 130 }
138 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, 131 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call,
139 const MediaConfig& config, 132 const MediaConfig& config,
140 const AudioOptions& options) { 133 const AudioOptions& options) {
141 return voice_.CreateChannel(call, config, options); 134 return voice().CreateChannel(call, config, options);
142 } 135 }
143 virtual VideoMediaChannel* CreateVideoChannel(webrtc::Call* call, 136 virtual VideoMediaChannel* CreateVideoChannel(webrtc::Call* call,
144 const MediaConfig& config, 137 const MediaConfig& config,
145 const VideoOptions& options) { 138 const VideoOptions& options) {
146 return video_.CreateChannel(call, config, options); 139 return video().CreateChannel(call, config, options);
147 } 140 }
148 141
149 virtual int GetInputLevel() { 142 virtual int GetInputLevel() { return voice().GetInputLevel(); }
150 return voice_.GetInputLevel();
151 }
152 virtual const std::vector<AudioCodec>& audio_send_codecs() { 143 virtual const std::vector<AudioCodec>& audio_send_codecs() {
153 return voice_.send_codecs(); 144 return voice().send_codecs();
154 } 145 }
155 virtual const std::vector<AudioCodec>& audio_recv_codecs() { 146 virtual const std::vector<AudioCodec>& audio_recv_codecs() {
156 return voice_.recv_codecs(); 147 return voice().recv_codecs();
157 } 148 }
158 virtual RtpCapabilities GetAudioCapabilities() { 149 virtual RtpCapabilities GetAudioCapabilities() {
159 return voice_.GetCapabilities(); 150 return voice().GetCapabilities();
160 } 151 }
161 virtual std::vector<VideoCodec> video_codecs() { return video_.codecs(); } 152 virtual std::vector<VideoCodec> video_codecs() { return video().codecs(); }
162 virtual RtpCapabilities GetVideoCapabilities() { 153 virtual RtpCapabilities GetVideoCapabilities() {
163 return video_.GetCapabilities(); 154 return video().GetCapabilities();
164 } 155 }
165 156
166 virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) { 157 virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) {
167 return voice_.StartAecDump(file, max_size_bytes); 158 return voice().StartAecDump(file, max_size_bytes);
168 } 159 }
169 160
170 virtual void StopAecDump() { 161 virtual void StopAecDump() { voice().StopAecDump(); }
171 voice_.StopAecDump();
172 }
173 162
174 protected: 163 protected:
175 VOICE voice_; 164 VOICE& voice() { return engines_.first; }
176 VIDEO video_; 165 VIDEO& video() { return engines_.second; }
166 const VOICE& voice() const { return engines_.first; }
167 const VIDEO& video() const { return engines_.second; }
168
169 private:
170 std::pair<VOICE, VIDEO> engines_;
177 }; 171 };
178 172
179 enum DataChannelType { DCT_NONE = 0, DCT_RTP = 1, DCT_SCTP = 2, DCT_QUIC = 3 }; 173 enum DataChannelType { DCT_NONE = 0, DCT_RTP = 1, DCT_SCTP = 2, DCT_QUIC = 3 };
180 174
181 class DataEngineInterface { 175 class DataEngineInterface {
182 public: 176 public:
183 virtual ~DataEngineInterface() {} 177 virtual ~DataEngineInterface() {}
184 virtual DataMediaChannel* CreateChannel(const MediaConfig& config) = 0; 178 virtual DataMediaChannel* CreateChannel(const MediaConfig& config) = 0;
185 virtual const std::vector<DataCodec>& data_codecs() = 0; 179 virtual const std::vector<DataCodec>& data_codecs() = 0;
186 }; 180 };
187 181
188 webrtc::RtpParameters CreateRtpParametersWithOneEncoding(); 182 webrtc::RtpParameters CreateRtpParametersWithOneEncoding();
189 183
190 } // namespace cricket 184 } // namespace cricket
191 185
192 #endif // WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ 186 #endif // WEBRTC_MEDIA_BASE_MEDIAENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/fakemediaengine.h ('k') | webrtc/media/base/videoengine_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698