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

Side by Side Diff: webrtc/media/base/capturemanager.cc

Issue 1733673002: Removed unused cricket::VideoCapturer methods (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed thread checker for android. SetCaptureFormat is called on the thread where the capturer is cr… 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/media/base/capturemanager.h ('k') | webrtc/media/base/capturemanager_unittest.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 (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return false; 191 return false;
192 } 192 }
193 193
194 if (capture_state->DecCaptureStartRef() == 0) { 194 if (capture_state->DecCaptureStartRef() == 0) {
195 // Unregistering cannot fail as capture_state is not NULL. 195 // Unregistering cannot fail as capture_state is not NULL.
196 UnregisterVideoCapturer(capture_state); 196 UnregisterVideoCapturer(capture_state);
197 } 197 }
198 return true; 198 return true;
199 } 199 }
200 200
201 bool CaptureManager::RestartVideoCapture(
202 VideoCapturer* video_capturer,
203 const VideoFormat& previous_format,
204 const VideoFormat& desired_format,
205 CaptureManager::RestartOptions options) {
206 RTC_DCHECK(thread_checker_.CalledOnValidThread());
207 if (!IsCapturerRegistered(video_capturer)) {
208 LOG(LS_ERROR) << "RestartVideoCapture: video_capturer is not registered.";
209 return false;
210 }
211 // Start the new format first. This keeps the capturer running.
212 if (!StartVideoCapture(video_capturer, desired_format)) {
213 LOG(LS_ERROR) << "RestartVideoCapture: unable to start video capture with "
214 "desired_format=" << desired_format.ToString();
215 return false;
216 }
217 // Stop the old format.
218 if (!StopVideoCapture(video_capturer, previous_format)) {
219 LOG(LS_ERROR) << "RestartVideoCapture: unable to stop video capture with "
220 "previous_format=" << previous_format.ToString();
221 // Undo the start request we just performed.
222 StopVideoCapture(video_capturer, desired_format);
223 return false;
224 }
225
226 switch (options) {
227 case kForceRestart: {
228 VideoCapturerState* capture_state = GetCaptureState(video_capturer);
229 ASSERT(capture_state && capture_state->start_count() > 0);
230 // Try a restart using the new best resolution.
231 VideoFormat highest_asked_format =
232 capture_state->GetHighestFormat(video_capturer);
233 VideoFormat capture_format;
234 if (video_capturer->GetBestCaptureFormat(highest_asked_format,
235 &capture_format)) {
236 if (!video_capturer->Restart(capture_format)) {
237 LOG(LS_ERROR) << "RestartVideoCapture: Restart failed.";
238 }
239 } else {
240 LOG(LS_WARNING)
241 << "RestartVideoCapture: Couldn't find a best capture format for "
242 << highest_asked_format.ToString();
243 }
244 break;
245 }
246 case kRequestRestart:
247 // TODO(ryanpetrie): Support restart requests. Should this
248 // to-be-implemented logic be used for {Start,Stop}VideoCapture as well?
249 break;
250 default:
251 LOG(LS_ERROR) << "Unknown/unimplemented RestartOption";
252 break;
253 }
254 return true;
255 }
256
257 void CaptureManager::AddVideoSink(VideoCapturer* video_capturer, 201 void CaptureManager::AddVideoSink(VideoCapturer* video_capturer,
258 rtc::VideoSinkInterface<VideoFrame>* sink) { 202 rtc::VideoSinkInterface<VideoFrame>* sink) {
259 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 203 RTC_DCHECK(thread_checker_.CalledOnValidThread());
260 // TODO(nisse): Do we really need to tolerate NULL inputs? 204 // TODO(nisse): Do we really need to tolerate NULL inputs?
261 if (!video_capturer || !sink) { 205 if (!video_capturer || !sink) {
262 return; 206 return;
263 } 207 }
264 rtc::VideoSinkWants wants; 208 rtc::VideoSinkWants wants;
265 // Renderers must be able to apply rotation. 209 // Renderers must be able to apply rotation.
266 wants.rotation_applied = false; 210 wants.rotation_applied = false;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 VideoCapturer* video_capturer) const { 290 VideoCapturer* video_capturer) const {
347 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 291 RTC_DCHECK(thread_checker_.CalledOnValidThread());
348 CaptureStates::const_iterator iter = capture_states_.find(video_capturer); 292 CaptureStates::const_iterator iter = capture_states_.find(video_capturer);
349 if (iter == capture_states_.end()) { 293 if (iter == capture_states_.end()) {
350 return NULL; 294 return NULL;
351 } 295 }
352 return iter->second; 296 return iter->second;
353 } 297 }
354 298
355 } // namespace cricket 299 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/capturemanager.h ('k') | webrtc/media/base/capturemanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698