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

Side by Side Diff: content/renderer/media/media_stream_video_capturer_source.cc

Issue 2446803002: Bug fix: stop mirroring session when tab is closed. Fix bug caused by cl: https://codereview.chromi… (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_video_capturer_source.h" 5 #include "content/renderer/media/media_stream_video_capturer_source.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // |session_id_| identifies the capture device used for this capture session. 226 // |session_id_| identifies the capture device used for this capture session.
227 const media::VideoCaptureSessionId session_id_; 227 const media::VideoCaptureSessionId session_id_;
228 228
229 VideoCaptureImplManager* const manager_; 229 VideoCaptureImplManager* const manager_;
230 230
231 const base::Closure release_device_cb_; 231 const base::Closure release_device_cb_;
232 232
233 // Indicates if we are capturing generated content, e.g. Tab or Desktop. 233 // Indicates if we are capturing generated content, e.g. Tab or Desktop.
234 const bool is_content_capture_; 234 const bool is_content_capture_;
235 235
236 // This is run once to report whether the device was successfully started 236 // These two are valid between StartCapture() and StopCapture().
237 // after a call to StartCapture(). 237 // |running_call_back_| is run when capture is successfully started, and when
238 // it is stopped or error happens.
238 RunningCallback running_callback_; 239 RunningCallback running_callback_;
239
240 // This is valid between StartCapture() and StopCapture().
241 base::Closure stop_capture_cb_; 240 base::Closure stop_capture_cb_;
242 241
243 // Placeholder keeping the callback between asynchronous device enumeration 242 // Placeholder keeping the callback between asynchronous device enumeration
244 // calls. 243 // calls.
245 VideoCaptureDeviceFormatsCB formats_enumerated_callback_; 244 VideoCaptureDeviceFormatsCB formats_enumerated_callback_;
246 245
247 // Bound to the main render thread. 246 // Bound to the main render thread.
248 base::ThreadChecker thread_checker_; 247 base::ThreadChecker thread_checker_;
249 248
250 base::WeakPtrFactory<LocalVideoCapturerSource> weak_factory_; 249 base::WeakPtrFactory<LocalVideoCapturerSource> weak_factory_;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 formats_enumerated_callback_.Reset(); 347 formats_enumerated_callback_.Reset();
349 } 348 }
350 349
351 void LocalVideoCapturerSource::OnStateUpdate(VideoCaptureState state) { 350 void LocalVideoCapturerSource::OnStateUpdate(VideoCaptureState state) {
352 DVLOG(3) << __func__ << " state = " << state; 351 DVLOG(3) << __func__ << " state = " << state;
353 DCHECK(thread_checker_.CalledOnValidThread()); 352 DCHECK(thread_checker_.CalledOnValidThread());
354 if (running_callback_.is_null()) 353 if (running_callback_.is_null())
355 return; 354 return;
356 switch (state) { 355 switch (state) {
357 case VIDEO_CAPTURE_STATE_STARTED: 356 case VIDEO_CAPTURE_STATE_STARTED:
358 base::ResetAndReturn(&running_callback_).Run(true); 357 running_callback_.Run(true);
359 break; 358 break;
360 359
361 case VIDEO_CAPTURE_STATE_STOPPING: 360 case VIDEO_CAPTURE_STATE_STOPPING:
362 case VIDEO_CAPTURE_STATE_STOPPED: 361 case VIDEO_CAPTURE_STATE_STOPPED:
363 case VIDEO_CAPTURE_STATE_ERROR: 362 case VIDEO_CAPTURE_STATE_ERROR:
364 case VIDEO_CAPTURE_STATE_ENDED: 363 case VIDEO_CAPTURE_STATE_ENDED:
365 base::ResetAndReturn(&running_callback_).Run(false); 364 base::ResetAndReturn(&running_callback_).Run(false);
366 break; 365 break;
367 366
368 case VIDEO_CAPTURE_STATE_PAUSED: 367 case VIDEO_CAPTURE_STATE_PAUSED:
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 void MediaStreamVideoCapturerSource::OnStarted(bool result) { 494 void MediaStreamVideoCapturerSource::OnStarted(bool result) {
496 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); 495 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE);
497 } 496 }
498 497
499 const char* 498 const char*
500 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { 499 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const {
501 return kPowerLineFrequency; 500 return kPowerLineFrequency;
502 } 501 }
503 502
504 } // namespace content 503 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698