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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "webrtc/media/base/mediachannel.h" | 26 #include "webrtc/media/base/mediachannel.h" |
27 #include "webrtc/media/base/mediacommon.h" | 27 #include "webrtc/media/base/mediacommon.h" |
28 #include "webrtc/media/base/videocapturer.h" | 28 #include "webrtc/media/base/videocapturer.h" |
29 #include "webrtc/media/base/videocommon.h" | 29 #include "webrtc/media/base/videocommon.h" |
30 | 30 |
31 #if defined(GOOGLE_CHROME_BUILD) || defined(CHROMIUM_BUILD) | 31 #if defined(GOOGLE_CHROME_BUILD) || defined(CHROMIUM_BUILD) |
32 #define DISABLE_MEDIA_ENGINE_FACTORY | 32 #define DISABLE_MEDIA_ENGINE_FACTORY |
33 #endif | 33 #endif |
34 | 34 |
35 namespace webrtc { | 35 namespace webrtc { |
| 36 class AudioDeviceModule; |
36 class Call; | 37 class Call; |
37 } | 38 } |
38 | 39 |
39 namespace cricket { | 40 namespace cricket { |
40 | 41 |
41 class VideoCapturer; | 42 class VideoCapturer; |
42 | 43 |
43 struct RtpCapabilities { | 44 struct RtpCapabilities { |
44 std::vector<RtpHeaderExtension> header_extensions; | 45 std::vector<RtpHeaderExtension> header_extensions; |
45 }; | 46 }; |
46 | 47 |
47 // MediaEngineInterface is an abstraction of a media engine which can be | 48 // MediaEngineInterface is an abstraction of a media engine which can be |
48 // subclassed to support different media componentry backends. | 49 // subclassed to support different media componentry backends. |
49 // It supports voice and video operations in the same class to facilitate | 50 // It supports voice and video operations in the same class to facilitate |
50 // proper synchronization between both media types. | 51 // proper synchronization between both media types. |
51 class MediaEngineInterface { | 52 class MediaEngineInterface { |
52 public: | 53 public: |
53 virtual ~MediaEngineInterface() {} | 54 virtual ~MediaEngineInterface() {} |
54 | 55 |
55 // Initialization | 56 // Initialization |
56 // Starts the engine. | 57 // Starts the engine. |
57 virtual bool Init(rtc::Thread* worker_thread) = 0; | 58 virtual bool Init() = 0; |
58 // Shuts down the engine. | |
59 virtual void Terminate() = 0; | |
60 // TODO(solenberg): Remove once VoE API refactoring is done. | 59 // TODO(solenberg): Remove once VoE API refactoring is done. |
61 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const = 0; | 60 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const = 0; |
62 | 61 |
63 // MediaChannel creation | 62 // MediaChannel creation |
64 // Creates a voice media channel. Returns NULL on failure. | 63 // Creates a voice media channel. Returns NULL on failure. |
65 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 64 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
66 const MediaConfig& config, | 65 const MediaConfig& config, |
67 const AudioOptions& options) = 0; | 66 const AudioOptions& options) = 0; |
68 // Creates a video media channel, paired with the specified voice channel. | 67 // Creates a video media channel, paired with the specified voice channel. |
69 // Returns NULL on failure. | 68 // Returns NULL on failure. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 private: | 117 private: |
119 static MediaEngineCreateFunction create_function_; | 118 static MediaEngineCreateFunction create_function_; |
120 }; | 119 }; |
121 #endif | 120 #endif |
122 | 121 |
123 // CompositeMediaEngine constructs a MediaEngine from separate | 122 // CompositeMediaEngine constructs a MediaEngine from separate |
124 // voice and video engine classes. | 123 // voice and video engine classes. |
125 template<class VOICE, class VIDEO> | 124 template<class VOICE, class VIDEO> |
126 class CompositeMediaEngine : public MediaEngineInterface { | 125 class CompositeMediaEngine : public MediaEngineInterface { |
127 public: | 126 public: |
| 127 explicit CompositeMediaEngine(webrtc::AudioDeviceModule* adm) : voice_(adm) {} |
128 virtual ~CompositeMediaEngine() {} | 128 virtual ~CompositeMediaEngine() {} |
129 virtual bool Init(rtc::Thread* worker_thread) { | 129 virtual bool Init() { |
130 if (!voice_.Init(worker_thread)) | |
131 return false; | |
132 video_.Init(); | 130 video_.Init(); |
133 return true; | 131 return true; |
134 } | 132 } |
135 virtual void Terminate() { | |
136 voice_.Terminate(); | |
137 } | |
138 | 133 |
139 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { | 134 virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const { |
140 return voice_.GetAudioState(); | 135 return voice_.GetAudioState(); |
141 } | 136 } |
142 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 137 virtual VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
143 const MediaConfig& config, | 138 const MediaConfig& config, |
144 const AudioOptions& options) { | 139 const AudioOptions& options) { |
145 return voice_.CreateChannel(call, config, options); | 140 return voice_.CreateChannel(call, config, options); |
146 } | 141 } |
147 virtual VideoMediaChannel* CreateVideoChannel(webrtc::Call* call, | 142 virtual VideoMediaChannel* CreateVideoChannel(webrtc::Call* call, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 virtual ~DataEngineInterface() {} | 198 virtual ~DataEngineInterface() {} |
204 virtual DataMediaChannel* CreateChannel(DataChannelType type) = 0; | 199 virtual DataMediaChannel* CreateChannel(DataChannelType type) = 0; |
205 virtual const std::vector<DataCodec>& data_codecs() = 0; | 200 virtual const std::vector<DataCodec>& data_codecs() = 0; |
206 }; | 201 }; |
207 | 202 |
208 webrtc::RtpParameters CreateRtpParametersWithOneEncoding(); | 203 webrtc::RtpParameters CreateRtpParametersWithOneEncoding(); |
209 | 204 |
210 } // namespace cricket | 205 } // namespace cricket |
211 | 206 |
212 #endif // WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ | 207 #endif // WEBRTC_MEDIA_BASE_MEDIAENGINE_H_ |
OLD | NEW |