OLD | NEW |
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 |
11 #ifndef WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ |
12 #define WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ | 12 #define WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ |
13 | 13 |
14 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) | 14 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) |
15 #include <CoreAudio/CoreAudio.h> | 15 #include <CoreAudio/CoreAudio.h> |
16 #endif | 16 #endif |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "webrtc/api/audio_codecs/audio_decoder_factory.h" | 21 #include "webrtc/api/audio_codecs/audio_decoder_factory.h" |
22 #include "webrtc/api/audio_codecs/audio_encoder_factory.h" | 22 #include "webrtc/api/audio_codecs/audio_encoder_factory.h" |
23 #include "webrtc/api/rtpparameters.h" | 23 #include "webrtc/api/rtpparameters.h" |
24 #include "webrtc/base/fileutils.h" | 24 #include "webrtc/base/fileutils.h" |
25 #include "webrtc/base/sigslotrepeater.h" | 25 #include "webrtc/base/sigslotrepeater.h" |
| 26 #include "webrtc/base/task_queue.h" |
26 #include "webrtc/call/audio_state.h" | 27 #include "webrtc/call/audio_state.h" |
27 #include "webrtc/media/base/codec.h" | 28 #include "webrtc/media/base/codec.h" |
28 #include "webrtc/media/base/mediachannel.h" | 29 #include "webrtc/media/base/mediachannel.h" |
29 #include "webrtc/media/base/videocommon.h" | 30 #include "webrtc/media/base/videocommon.h" |
30 | 31 |
31 #if defined(GOOGLE_CHROME_BUILD) || defined(CHROMIUM_BUILD) | 32 #if defined(GOOGLE_CHROME_BUILD) || defined(CHROMIUM_BUILD) |
32 #define DISABLE_MEDIA_ENGINE_FACTORY | 33 #define DISABLE_MEDIA_ENGINE_FACTORY |
33 #endif | 34 #endif |
34 | 35 |
| 36 namespace rtc { |
| 37 class TaskQueue; |
| 38 } |
| 39 |
35 namespace webrtc { | 40 namespace webrtc { |
36 class AudioDeviceModule; | 41 class AudioDeviceModule; |
37 class AudioMixer; | 42 class AudioMixer; |
38 class Call; | 43 class Call; |
39 } | 44 } |
40 | 45 |
41 namespace cricket { | 46 namespace cricket { |
42 | 47 |
43 struct RtpCapabilities { | 48 struct RtpCapabilities { |
44 std::vector<webrtc::RtpExtension> header_extensions; | 49 std::vector<webrtc::RtpExtension> header_extensions; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // CompositeMediaEngine constructs a MediaEngine from separate | 115 // CompositeMediaEngine constructs a MediaEngine from separate |
111 // voice and video engine classes. | 116 // voice and video engine classes. |
112 template<class VOICE, class VIDEO> | 117 template<class VOICE, class VIDEO> |
113 class CompositeMediaEngine : public MediaEngineInterface { | 118 class CompositeMediaEngine : public MediaEngineInterface { |
114 public: | 119 public: |
115 CompositeMediaEngine(webrtc::AudioDeviceModule* adm, | 120 CompositeMediaEngine(webrtc::AudioDeviceModule* adm, |
116 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& | 121 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& |
117 audio_encoder_factory, | 122 audio_encoder_factory, |
118 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& | 123 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& |
119 audio_decoder_factory, | 124 audio_decoder_factory, |
120 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer) | 125 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
121 : voice_(adm, audio_encoder_factory, audio_decoder_factory, audio_mixer) { | 126 rtc::TaskQueue* low_priority_worker_queue) |
122 } | 127 : owned_low_priority_worker_queue_( |
| 128 low_priority_worker_queue |
| 129 ? nullptr |
| 130 : new rtc::TaskQueue("low_prio_worker_queue", |
| 131 rtc::TaskQueue::Priority::LOW)), |
| 132 voice_(adm, |
| 133 audio_encoder_factory, |
| 134 audio_decoder_factory, |
| 135 audio_mixer, |
| 136 low_priority_worker_queue |
| 137 ? owned_low_priority_worker_queue_.get() |
| 138 : low_priority_worker_queue) {} |
123 virtual ~CompositeMediaEngine() {} | 139 virtual ~CompositeMediaEngine() {} |
124 virtual bool Init() { | 140 virtual bool Init() { |
125 video_.Init(); | 141 video_.Init(); |
126 return true; | 142 return true; |
127 } | 143 } |
128 | 144 |
129 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { | 145 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { |
130 return voice_.GetAudioState(); | 146 return voice_.GetAudioState(); |
131 } | 147 } |
132 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 148 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
(...skipping 25 matching lines...) Expand all Loading... |
158 } | 174 } |
159 | 175 |
160 virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) { | 176 virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) { |
161 return voice_.StartAecDump(file, max_size_bytes); | 177 return voice_.StartAecDump(file, max_size_bytes); |
162 } | 178 } |
163 | 179 |
164 virtual void StopAecDump() { | 180 virtual void StopAecDump() { |
165 voice_.StopAecDump(); | 181 voice_.StopAecDump(); |
166 } | 182 } |
167 | 183 |
| 184 private: |
| 185 std::unique_ptr<rtc::TaskQueue> owned_low_priority_worker_queue_; |
| 186 |
168 protected: | 187 protected: |
169 VOICE voice_; | 188 VOICE voice_; |
170 VIDEO video_; | 189 VIDEO video_; |
171 }; | 190 }; |
172 | 191 |
173 enum DataChannelType { DCT_NONE = 0, DCT_RTP = 1, DCT_SCTP = 2, DCT_QUIC = 3 }; | 192 enum DataChannelType { DCT_NONE = 0, DCT_RTP = 1, DCT_SCTP = 2, DCT_QUIC = 3 }; |
174 | 193 |
175 class DataEngineInterface { | 194 class DataEngineInterface { |
176 public: | 195 public: |
177 virtual ~DataEngineInterface() {} | 196 virtual ~DataEngineInterface() {} |
178 virtual DataMediaChannel* CreateChannel(const MediaConfig& config) = 0; | 197 virtual DataMediaChannel* CreateChannel(const MediaConfig& config) = 0; |
179 virtual const std::vector<DataCodec>& data_codecs() = 0; | 198 virtual const std::vector<DataCodec>& data_codecs() = 0; |
180 }; | 199 }; |
181 | 200 |
182 webrtc::RtpParameters CreateRtpParametersWithOneEncoding(); | 201 webrtc::RtpParameters CreateRtpParametersWithOneEncoding(); |
183 | 202 |
184 } // namespace cricket | 203 } // namespace cricket |
185 | 204 |
186 #endif // WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ | 205 #endif // WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ |
OLD | NEW |