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

Side by Side Diff: webrtc/pc/channelmanager.h

Issue 1757843003: Remove CaptureManager and related calls in ChannelManager. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 9 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/pc/channel_unittest.cc ('k') | webrtc/pc/channelmanager.cc » ('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 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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_PC_CHANNELMANAGER_H_ 11 #ifndef WEBRTC_PC_CHANNELMANAGER_H_
12 #define WEBRTC_PC_CHANNELMANAGER_H_ 12 #define WEBRTC_PC_CHANNELMANAGER_H_
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/fileutils.h" 17 #include "webrtc/base/fileutils.h"
19 #include "webrtc/base/sigslotrepeater.h"
20 #include "webrtc/base/thread.h" 18 #include "webrtc/base/thread.h"
21 #include "webrtc/media/base/capturemanager.h"
22 #include "webrtc/media/base/mediaengine.h" 19 #include "webrtc/media/base/mediaengine.h"
23 #include "webrtc/pc/voicechannel.h" 20 #include "webrtc/pc/voicechannel.h"
24 21
25 namespace webrtc { 22 namespace webrtc {
26 class MediaControllerInterface; 23 class MediaControllerInterface;
27 } 24 }
28 namespace cricket { 25 namespace cricket {
29 26
30 class VoiceChannel; 27 class VoiceChannel;
31 28
32 // ChannelManager allows the MediaEngine to run on a separate thread, and takes 29 // ChannelManager allows the MediaEngine to run on a separate thread, and takes
33 // care of marshalling calls between threads. It also creates and keeps track of 30 // care of marshalling calls between threads. It also creates and keeps track of
34 // voice and video channels; by doing so, it can temporarily pause all the 31 // voice and video channels; by doing so, it can temporarily pause all the
35 // channels when a new audio or video device is chosen. The voice and video 32 // channels when a new audio or video device is chosen. The voice and video
36 // channels are stored in separate vectors, to easily allow operations on just 33 // channels are stored in separate vectors, to easily allow operations on just
37 // voice or just video channels. 34 // voice or just video channels.
38 // ChannelManager also allows the application to discover what devices it has 35 // ChannelManager also allows the application to discover what devices it has
39 // using device manager. 36 // using device manager.
40 class ChannelManager : public rtc::MessageHandler, 37 class ChannelManager {
41 public sigslot::has_slots<> {
42 public: 38 public:
43 // For testing purposes. Allows the media engine and data media 39 // For testing purposes. Allows the media engine and data media
44 // engine and dev manager to be mocks. The ChannelManager takes 40 // engine and dev manager to be mocks. The ChannelManager takes
45 // ownership of these objects. 41 // ownership of these objects.
46 ChannelManager(MediaEngineInterface* me, 42 ChannelManager(MediaEngineInterface* me,
47 DataEngineInterface* dme, 43 DataEngineInterface* dme,
48 CaptureManager* cm,
49 rtc::Thread* worker); 44 rtc::Thread* worker);
50 // Same as above, but gives an easier default DataEngine. 45 // Same as above, but gives an easier default DataEngine.
51 ChannelManager(MediaEngineInterface* me, 46 ChannelManager(MediaEngineInterface* me,
52 rtc::Thread* worker); 47 rtc::Thread* worker);
53 ~ChannelManager(); 48 ~ChannelManager();
54 49
55 // Accessors for the worker thread, allowing it to be set after construction, 50 // Accessors for the worker thread, allowing it to be set after construction,
56 // but before Init. set_worker_thread will return false if called after Init. 51 // but before Init. set_worker_thread will return false if called after Init.
57 rtc::Thread* worker_thread() const { return worker_thread_; } 52 rtc::Thread* worker_thread() const { return worker_thread_; }
58 bool set_worker_thread(rtc::Thread* thread) { 53 bool set_worker_thread(rtc::Thread* thread) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 107
113 bool GetOutputVolume(int* level); 108 bool GetOutputVolume(int* level);
114 bool SetOutputVolume(int level); 109 bool SetOutputVolume(int level);
115 // RTX will be enabled/disabled in engines that support it. The supporting 110 // RTX will be enabled/disabled in engines that support it. The supporting
116 // engines will start offering an RTX codec. Must be called before Init(). 111 // engines will start offering an RTX codec. Must be called before Init().
117 bool SetVideoRtxEnabled(bool enable); 112 bool SetVideoRtxEnabled(bool enable);
118 113
119 // Starts/stops the local microphone and enables polling of the input level. 114 // Starts/stops the local microphone and enables polling of the input level.
120 bool capturing() const { return capturing_; } 115 bool capturing() const { return capturing_; }
121 116
122 // Gets capturer's supported formats in a thread safe manner
123 std::vector<cricket::VideoFormat> GetSupportedFormats(
124 VideoCapturer* capturer) const;
125 // The following are done in the new "CaptureManager" style that
126 // all local video capturers, processors, and managers should move to.
127 // TODO(pthatcher): Make methods nicer by having start return a handle that
128 // can be used for stop and restart, rather than needing to pass around
129 // formats a a pseudo-handle.
130 bool StartVideoCapture(VideoCapturer* video_capturer,
131 const VideoFormat& video_format);
132 bool StopVideoCapture(VideoCapturer* video_capturer,
133 const VideoFormat& video_format);
134 bool RestartVideoCapture(VideoCapturer* video_capturer,
135 const VideoFormat& previous_format,
136 const VideoFormat& desired_format,
137 CaptureManager::RestartOptions options);
138
139 virtual void AddVideoSink(VideoCapturer* video_capturer,
140 rtc::VideoSinkInterface<VideoFrame>* sink);
141 virtual void RemoveVideoSink(VideoCapturer* video_capturer,
142 rtc::VideoSinkInterface<VideoFrame>* sink);
143 bool IsScreencastRunning() const;
144
145 // The operations below occur on the main thread. 117 // The operations below occur on the main thread.
146 118
147 // Starts AEC dump using existing file, with a specified maximum file size in 119 // Starts AEC dump using existing file, with a specified maximum file size in
148 // bytes. When the limit is reached, logging will stop and the file will be 120 // bytes. When the limit is reached, logging will stop and the file will be
149 // closed. If max_size_bytes is set to <= 0, no limit will be used. 121 // closed. If max_size_bytes is set to <= 0, no limit will be used.
150 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes); 122 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes);
151 123
152 // Stops recording AEC dump. 124 // Stops recording AEC dump.
153 void StopAecDump(); 125 void StopAecDump();
154 126
155 // Starts RtcEventLog using existing file. 127 // Starts RtcEventLog using existing file.
156 bool StartRtcEventLog(rtc::PlatformFile file); 128 bool StartRtcEventLog(rtc::PlatformFile file);
157 129
158 // Stops logging RtcEventLog. 130 // Stops logging RtcEventLog.
159 void StopRtcEventLog(); 131 void StopRtcEventLog();
160 132
161 sigslot::signal2<VideoCapturer*, CaptureState> SignalVideoCaptureStateChange;
162
163 private: 133 private:
164 typedef std::vector<VoiceChannel*> VoiceChannels; 134 typedef std::vector<VoiceChannel*> VoiceChannels;
165 typedef std::vector<VideoChannel*> VideoChannels; 135 typedef std::vector<VideoChannel*> VideoChannels;
166 typedef std::vector<DataChannel*> DataChannels; 136 typedef std::vector<DataChannel*> DataChannels;
167 137
168 void Construct(MediaEngineInterface* me, 138 void Construct(MediaEngineInterface* me,
169 DataEngineInterface* dme, 139 DataEngineInterface* dme,
170 CaptureManager* cm,
171 rtc::Thread* worker_thread); 140 rtc::Thread* worker_thread);
172 bool InitMediaEngine_w(); 141 bool InitMediaEngine_w();
173 void DestructorDeletes_w(); 142 void DestructorDeletes_w();
174 void Terminate_w(); 143 void Terminate_w();
175 VoiceChannel* CreateVoiceChannel_w( 144 VoiceChannel* CreateVoiceChannel_w(
176 webrtc::MediaControllerInterface* media_controller, 145 webrtc::MediaControllerInterface* media_controller,
177 TransportController* transport_controller, 146 TransportController* transport_controller,
178 const std::string& content_name, 147 const std::string& content_name,
179 bool rtcp, 148 bool rtcp,
180 const AudioOptions& options); 149 const AudioOptions& options);
181 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); 150 void DestroyVoiceChannel_w(VoiceChannel* voice_channel);
182 VideoChannel* CreateVideoChannel_w( 151 VideoChannel* CreateVideoChannel_w(
183 webrtc::MediaControllerInterface* media_controller, 152 webrtc::MediaControllerInterface* media_controller,
184 TransportController* transport_controller, 153 TransportController* transport_controller,
185 const std::string& content_name, 154 const std::string& content_name,
186 bool rtcp, 155 bool rtcp,
187 const VideoOptions& options); 156 const VideoOptions& options);
188 void DestroyVideoChannel_w(VideoChannel* video_channel); 157 void DestroyVideoChannel_w(VideoChannel* video_channel);
189 DataChannel* CreateDataChannel_w(TransportController* transport_controller, 158 DataChannel* CreateDataChannel_w(TransportController* transport_controller,
190 const std::string& content_name, 159 const std::string& content_name,
191 bool rtcp, 160 bool rtcp,
192 DataChannelType data_channel_type); 161 DataChannelType data_channel_type);
193 void DestroyDataChannel_w(DataChannel* data_channel); 162 void DestroyDataChannel_w(DataChannel* data_channel);
194 void OnVideoCaptureStateChange(VideoCapturer* capturer,
195 CaptureState result);
196 void GetSupportedFormats_w(
197 VideoCapturer* capturer,
198 std::vector<cricket::VideoFormat>* out_formats) const;
199 bool IsScreencastRunning_w() const;
200 virtual void OnMessage(rtc::Message *message);
201 163
202 rtc::scoped_ptr<MediaEngineInterface> media_engine_; 164 rtc::scoped_ptr<MediaEngineInterface> media_engine_;
203 rtc::scoped_ptr<DataEngineInterface> data_media_engine_; 165 rtc::scoped_ptr<DataEngineInterface> data_media_engine_;
204 rtc::scoped_ptr<CaptureManager> capture_manager_;
205 bool initialized_; 166 bool initialized_;
206 rtc::Thread* main_thread_; 167 rtc::Thread* main_thread_;
207 rtc::Thread* worker_thread_; 168 rtc::Thread* worker_thread_;
208 169
209 VoiceChannels voice_channels_; 170 VoiceChannels voice_channels_;
210 VideoChannels video_channels_; 171 VideoChannels video_channels_;
211 DataChannels data_channels_; 172 DataChannels data_channels_;
212 173
213 int audio_output_volume_; 174 int audio_output_volume_;
214 bool enable_rtx_; 175 bool enable_rtx_;
215 176
216 bool capturing_; 177 bool capturing_;
217 }; 178 };
218 179
219 } // namespace cricket 180 } // namespace cricket
220 181
221 #endif // WEBRTC_PC_CHANNELMANAGER_H_ 182 #endif // WEBRTC_PC_CHANNELMANAGER_H_
OLDNEW
« no previous file with comments | « webrtc/pc/channel_unittest.cc ('k') | webrtc/pc/channelmanager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698