OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "talk/media/base/capturemanager.h" | 34 #include "talk/media/base/capturemanager.h" |
35 #include "talk/media/base/mediaengine.h" | 35 #include "talk/media/base/mediaengine.h" |
36 #include "webrtc/p2p/base/session.h" | 36 #include "webrtc/p2p/base/session.h" |
37 #include "talk/session/media/voicechannel.h" | 37 #include "talk/session/media/voicechannel.h" |
38 #include "webrtc/base/criticalsection.h" | 38 #include "webrtc/base/criticalsection.h" |
39 #include "webrtc/base/fileutils.h" | 39 #include "webrtc/base/fileutils.h" |
40 #include "webrtc/base/sigslotrepeater.h" | 40 #include "webrtc/base/sigslotrepeater.h" |
41 #include "webrtc/base/thread.h" | 41 #include "webrtc/base/thread.h" |
42 | 42 |
| 43 namespace webrtc { |
| 44 class MediaControllerInterface; |
| 45 } |
43 namespace cricket { | 46 namespace cricket { |
44 | 47 |
45 const int kDefaultAudioDelayOffset = 0; | 48 const int kDefaultAudioDelayOffset = 0; |
46 | 49 |
47 class VoiceChannel; | 50 class VoiceChannel; |
48 class VoiceProcessor; | 51 class VoiceProcessor; |
49 | 52 |
50 // ChannelManager allows the MediaEngine to run on a separate thread, and takes | 53 // ChannelManager allows the MediaEngine to run on a separate thread, and takes |
51 // care of marshalling calls between threads. It also creates and keeps track of | 54 // care of marshalling calls between threads. It also creates and keeps track of |
52 // voice and video channels; by doing so, it can temporarily pause all the | 55 // voice and video channels; by doing so, it can temporarily pause all the |
(...skipping 21 matching lines...) Expand all Loading... |
74 | 77 |
75 // Accessors for the worker thread, allowing it to be set after construction, | 78 // Accessors for the worker thread, allowing it to be set after construction, |
76 // but before Init. set_worker_thread will return false if called after Init. | 79 // but before Init. set_worker_thread will return false if called after Init. |
77 rtc::Thread* worker_thread() const { return worker_thread_; } | 80 rtc::Thread* worker_thread() const { return worker_thread_; } |
78 bool set_worker_thread(rtc::Thread* thread) { | 81 bool set_worker_thread(rtc::Thread* thread) { |
79 if (initialized_) return false; | 82 if (initialized_) return false; |
80 worker_thread_ = thread; | 83 worker_thread_ = thread; |
81 return true; | 84 return true; |
82 } | 85 } |
83 | 86 |
| 87 MediaEngineInterface* media_engine() { return media_engine_.get(); } |
| 88 |
84 // Gets capabilities. Can be called prior to starting the media engine. | 89 // Gets capabilities. Can be called prior to starting the media engine. |
85 int GetCapabilities(); | 90 int GetCapabilities(); |
86 | 91 |
87 // Retrieves the list of supported audio & video codec types. | 92 // Retrieves the list of supported audio & video codec types. |
88 // Can be called before starting the media engine. | 93 // Can be called before starting the media engine. |
89 void GetSupportedAudioCodecs(std::vector<AudioCodec>* codecs) const; | 94 void GetSupportedAudioCodecs(std::vector<AudioCodec>* codecs) const; |
90 void GetSupportedAudioRtpHeaderExtensions(RtpHeaderExtensions* ext) const; | 95 void GetSupportedAudioRtpHeaderExtensions(RtpHeaderExtensions* ext) const; |
91 void GetSupportedVideoCodecs(std::vector<VideoCodec>* codecs) const; | 96 void GetSupportedVideoCodecs(std::vector<VideoCodec>* codecs) const; |
92 void GetSupportedVideoRtpHeaderExtensions(RtpHeaderExtensions* ext) const; | 97 void GetSupportedVideoRtpHeaderExtensions(RtpHeaderExtensions* ext) const; |
93 void GetSupportedDataCodecs(std::vector<DataCodec>* codecs) const; | 98 void GetSupportedDataCodecs(std::vector<DataCodec>* codecs) const; |
94 | 99 |
95 // Indicates whether the media engine is started. | 100 // Indicates whether the media engine is started. |
96 bool initialized() const { return initialized_; } | 101 bool initialized() const { return initialized_; } |
97 // Starts up the media engine. | 102 // Starts up the media engine. |
98 bool Init(); | 103 bool Init(); |
99 // Shuts down the media engine. | 104 // Shuts down the media engine. |
100 void Terminate(); | 105 void Terminate(); |
101 | 106 |
102 // The operations below all occur on the worker thread. | 107 // The operations below all occur on the worker thread. |
103 | 108 |
104 // Creates a voice channel, to be associated with the specified session. | 109 // Creates a voice channel, to be associated with the specified session. |
105 VoiceChannel* CreateVoiceChannel(BaseSession* session, | 110 VoiceChannel* CreateVoiceChannel( |
106 const std::string& content_name, | 111 webrtc::MediaControllerInterface* media_controller, |
107 bool rtcp, | 112 BaseSession* session, |
108 const AudioOptions& options); | 113 const std::string& content_name, |
| 114 bool rtcp, |
| 115 const AudioOptions& options); |
109 // Destroys a voice channel created with the Create API. | 116 // Destroys a voice channel created with the Create API. |
110 void DestroyVoiceChannel(VoiceChannel* voice_channel, | 117 void DestroyVoiceChannel(VoiceChannel* voice_channel); |
111 VideoChannel* video_channel); | |
112 // TODO(pbos): Remove as soon as all call sites specify VideoOptions. | |
113 VideoChannel* CreateVideoChannel(BaseSession* session, | |
114 const std::string& content_name, | |
115 bool rtcp, | |
116 VoiceChannel* voice_channel); | |
117 // Creates a video channel, synced with the specified voice channel, and | 118 // Creates a video channel, synced with the specified voice channel, and |
118 // associated with the specified session. | 119 // associated with the specified session. |
119 VideoChannel* CreateVideoChannel(BaseSession* session, | 120 VideoChannel* CreateVideoChannel( |
120 const std::string& content_name, | 121 webrtc::MediaControllerInterface* media_controller, |
121 bool rtcp, | 122 BaseSession* session, |
122 const VideoOptions& options, | 123 const std::string& content_name, |
123 VoiceChannel* voice_channel); | 124 bool rtcp, |
| 125 const VideoOptions& options); |
124 // Destroys a video channel created with the Create API. | 126 // Destroys a video channel created with the Create API. |
125 void DestroyVideoChannel(VideoChannel* video_channel); | 127 void DestroyVideoChannel(VideoChannel* video_channel); |
126 DataChannel* CreateDataChannel( | 128 DataChannel* CreateDataChannel( |
127 BaseSession* session, const std::string& content_name, | 129 BaseSession* session, const std::string& content_name, |
128 bool rtcp, DataChannelType data_channel_type); | 130 bool rtcp, DataChannelType data_channel_type); |
129 // Destroys a data channel created with the Create API. | 131 // Destroys a data channel created with the Create API. |
130 void DestroyDataChannel(DataChannel* data_channel); | 132 void DestroyDataChannel(DataChannel* data_channel); |
131 | 133 |
132 // Indicates whether any channels exist. | 134 // Indicates whether any channels exist. |
133 bool has_channels() const { | 135 bool has_channels() const { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 typedef std::vector<DataChannel*> DataChannels; | 242 typedef std::vector<DataChannel*> DataChannels; |
241 | 243 |
242 void Construct(MediaEngineInterface* me, | 244 void Construct(MediaEngineInterface* me, |
243 DataEngineInterface* dme, | 245 DataEngineInterface* dme, |
244 DeviceManagerInterface* dm, | 246 DeviceManagerInterface* dm, |
245 CaptureManager* cm, | 247 CaptureManager* cm, |
246 rtc::Thread* worker_thread); | 248 rtc::Thread* worker_thread); |
247 bool InitMediaEngine_w(); | 249 bool InitMediaEngine_w(); |
248 void DestructorDeletes_w(); | 250 void DestructorDeletes_w(); |
249 void Terminate_w(); | 251 void Terminate_w(); |
250 VoiceChannel* CreateVoiceChannel_w(BaseSession* session, | 252 VoiceChannel* CreateVoiceChannel_w( |
251 const std::string& content_name, | 253 webrtc::MediaControllerInterface* media_controller, |
252 bool rtcp, | 254 BaseSession* session, |
253 const AudioOptions& options); | 255 const std::string& content_name, |
254 void DestroyVoiceChannel_w(VoiceChannel* voice_channel, | 256 bool rtcp, |
255 VideoChannel* video_channel); | 257 const AudioOptions& options); |
256 VideoChannel* CreateVideoChannel_w(BaseSession* session, | 258 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); |
257 const std::string& content_name, | 259 VideoChannel* CreateVideoChannel_w( |
258 bool rtcp, | 260 webrtc::MediaControllerInterface* media_controller, |
259 const VideoOptions& options, | 261 BaseSession* session, |
260 VoiceChannel* voice_channel); | 262 const std::string& content_name, |
| 263 bool rtcp, |
| 264 const VideoOptions& options); |
261 void DestroyVideoChannel_w(VideoChannel* video_channel); | 265 void DestroyVideoChannel_w(VideoChannel* video_channel); |
262 DataChannel* CreateDataChannel_w( | 266 DataChannel* CreateDataChannel_w( |
263 BaseSession* session, const std::string& content_name, | 267 BaseSession* session, const std::string& content_name, |
264 bool rtcp, DataChannelType data_channel_type); | 268 bool rtcp, DataChannelType data_channel_type); |
265 void DestroyDataChannel_w(DataChannel* data_channel); | 269 void DestroyDataChannel_w(DataChannel* data_channel); |
266 bool SetAudioOptions_w(const AudioOptions& options, int delay_offset, | 270 bool SetAudioOptions_w(const AudioOptions& options, int delay_offset, |
267 const Device* in_dev, const Device* out_dev); | 271 const Device* in_dev, const Device* out_dev); |
268 bool SetCaptureDevice_w(const Device* cam_device); | 272 bool SetCaptureDevice_w(const Device* cam_device); |
269 void OnVideoCaptureStateChange(VideoCapturer* capturer, | 273 void OnVideoCaptureStateChange(VideoCapturer* capturer, |
270 CaptureState result); | 274 CaptureState result); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // but selected devices while this sting will be empty or contain current | 308 // but selected devices while this sting will be empty or contain current |
305 // selected device. | 309 // selected device. |
306 // TODO(hellner): refactor the code such that there is no need to keep two | 310 // TODO(hellner): refactor the code such that there is no need to keep two |
307 // strings for video devices that have subtle differences in behavior. | 311 // strings for video devices that have subtle differences in behavior. |
308 std::string video_device_name_; | 312 std::string video_device_name_; |
309 }; | 313 }; |
310 | 314 |
311 } // namespace cricket | 315 } // namespace cricket |
312 | 316 |
313 #endif // TALK_SESSION_MEDIA_CHANNELMANAGER_H_ | 317 #endif // TALK_SESSION_MEDIA_CHANNELMANAGER_H_ |
OLD | NEW |