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 MediaController; | |
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(BaseSession* session, |
106 const std::string& content_name, | 111 const std::string& content_name, |
107 bool rtcp, | 112 bool rtcp, |
113 webrtc::MediaController* media_controller, | |
pthatcher1
2015/09/09 07:27:43
I think it should be the first argument.
the sun
2015/09/09 08:24:51
Done.
| |
108 const AudioOptions& options); | 114 const AudioOptions& options); |
109 // Destroys a voice channel created with the Create API. | 115 // Destroys a voice channel created with the Create API. |
110 void DestroyVoiceChannel(VoiceChannel* voice_channel, | 116 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 | 117 // Creates a video channel, synced with the specified voice channel, and |
118 // associated with the specified session. | 118 // associated with the specified session. |
119 VideoChannel* CreateVideoChannel(BaseSession* session, | 119 VideoChannel* CreateVideoChannel(BaseSession* session, |
120 const std::string& content_name, | 120 const std::string& content_name, |
121 bool rtcp, | 121 bool rtcp, |
122 const VideoOptions& options, | 122 webrtc::MediaController* media_controller, |
123 VoiceChannel* voice_channel); | 123 const VideoOptions& options); |
124 // Destroys a video channel created with the Create API. | 124 // Destroys a video channel created with the Create API. |
125 void DestroyVideoChannel(VideoChannel* video_channel); | 125 void DestroyVideoChannel(VideoChannel* video_channel); |
126 DataChannel* CreateDataChannel( | 126 DataChannel* CreateDataChannel( |
127 BaseSession* session, const std::string& content_name, | 127 BaseSession* session, const std::string& content_name, |
128 bool rtcp, DataChannelType data_channel_type); | 128 bool rtcp, DataChannelType data_channel_type); |
129 // Destroys a data channel created with the Create API. | 129 // Destroys a data channel created with the Create API. |
130 void DestroyDataChannel(DataChannel* data_channel); | 130 void DestroyDataChannel(DataChannel* data_channel); |
131 | 131 |
132 // Indicates whether any channels exist. | 132 // Indicates whether any channels exist. |
133 bool has_channels() const { | 133 bool has_channels() const { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 DataEngineInterface* dme, | 243 DataEngineInterface* dme, |
244 DeviceManagerInterface* dm, | 244 DeviceManagerInterface* dm, |
245 CaptureManager* cm, | 245 CaptureManager* cm, |
246 rtc::Thread* worker_thread); | 246 rtc::Thread* worker_thread); |
247 bool InitMediaEngine_w(); | 247 bool InitMediaEngine_w(); |
248 void DestructorDeletes_w(); | 248 void DestructorDeletes_w(); |
249 void Terminate_w(); | 249 void Terminate_w(); |
250 VoiceChannel* CreateVoiceChannel_w(BaseSession* session, | 250 VoiceChannel* CreateVoiceChannel_w(BaseSession* session, |
251 const std::string& content_name, | 251 const std::string& content_name, |
252 bool rtcp, | 252 bool rtcp, |
253 webrtc::MediaController* media_controller, | |
253 const AudioOptions& options); | 254 const AudioOptions& options); |
254 void DestroyVoiceChannel_w(VoiceChannel* voice_channel, | 255 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); |
255 VideoChannel* video_channel); | |
256 VideoChannel* CreateVideoChannel_w(BaseSession* session, | 256 VideoChannel* CreateVideoChannel_w(BaseSession* session, |
257 const std::string& content_name, | 257 const std::string& content_name, |
258 bool rtcp, | 258 bool rtcp, |
259 const VideoOptions& options, | 259 webrtc::MediaController* media_controller, |
260 VoiceChannel* voice_channel); | 260 const VideoOptions& options); |
261 void DestroyVideoChannel_w(VideoChannel* video_channel); | 261 void DestroyVideoChannel_w(VideoChannel* video_channel); |
262 DataChannel* CreateDataChannel_w( | 262 DataChannel* CreateDataChannel_w( |
263 BaseSession* session, const std::string& content_name, | 263 BaseSession* session, const std::string& content_name, |
264 bool rtcp, DataChannelType data_channel_type); | 264 bool rtcp, DataChannelType data_channel_type); |
265 void DestroyDataChannel_w(DataChannel* data_channel); | 265 void DestroyDataChannel_w(DataChannel* data_channel); |
266 bool SetAudioOptions_w(const AudioOptions& options, int delay_offset, | 266 bool SetAudioOptions_w(const AudioOptions& options, int delay_offset, |
267 const Device* in_dev, const Device* out_dev); | 267 const Device* in_dev, const Device* out_dev); |
268 bool SetCaptureDevice_w(const Device* cam_device); | 268 bool SetCaptureDevice_w(const Device* cam_device); |
269 void OnVideoCaptureStateChange(VideoCapturer* capturer, | 269 void OnVideoCaptureStateChange(VideoCapturer* capturer, |
270 CaptureState result); | 270 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 | 304 // but selected devices while this sting will be empty or contain current |
305 // selected device. | 305 // selected device. |
306 // TODO(hellner): refactor the code such that there is no need to keep two | 306 // 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. | 307 // strings for video devices that have subtle differences in behavior. |
308 std::string video_device_name_; | 308 std::string video_device_name_; |
309 }; | 309 }; |
310 | 310 |
311 } // namespace cricket | 311 } // namespace cricket |
312 | 312 |
313 #endif // TALK_SESSION_MEDIA_CHANNELMANAGER_H_ | 313 #endif // TALK_SESSION_MEDIA_CHANNELMANAGER_H_ |
OLD | NEW |