Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(). | |
| 238 RunningCallback running_callback_; | 237 RunningCallback running_callback_; |
|
mcasas
2016/10/13 13:48:43
nit: the name is misleading, maybe we could
call i
xjz
2016/10/13 18:11:39
Yes, the name sounds a little confusing. But it se
| |
| 239 | |
| 240 // This is valid between StartCapture() and StopCapture(). | |
| 241 base::Closure stop_capture_cb_; | 238 base::Closure stop_capture_cb_; |
| 242 | 239 |
| 243 // Placeholder keeping the callback between asynchronous device enumeration | 240 // Placeholder keeping the callback between asynchronous device enumeration |
| 244 // calls. | 241 // calls. |
| 245 VideoCaptureDeviceFormatsCB formats_enumerated_callback_; | 242 VideoCaptureDeviceFormatsCB formats_enumerated_callback_; |
| 246 | 243 |
| 247 // Bound to the main render thread. | 244 // Bound to the main render thread. |
| 248 base::ThreadChecker thread_checker_; | 245 base::ThreadChecker thread_checker_; |
| 249 | 246 |
| 250 base::WeakPtrFactory<LocalVideoCapturerSource> weak_factory_; | 247 base::WeakPtrFactory<LocalVideoCapturerSource> weak_factory_; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 formats_enumerated_callback_.Reset(); | 345 formats_enumerated_callback_.Reset(); |
| 349 } | 346 } |
| 350 | 347 |
| 351 void LocalVideoCapturerSource::OnStateUpdate(VideoCaptureState state) { | 348 void LocalVideoCapturerSource::OnStateUpdate(VideoCaptureState state) { |
| 352 DVLOG(3) << __func__ << " state = " << state; | 349 DVLOG(3) << __func__ << " state = " << state; |
| 353 DCHECK(thread_checker_.CalledOnValidThread()); | 350 DCHECK(thread_checker_.CalledOnValidThread()); |
| 354 if (running_callback_.is_null()) | 351 if (running_callback_.is_null()) |
| 355 return; | 352 return; |
| 356 switch (state) { | 353 switch (state) { |
| 357 case VIDEO_CAPTURE_STATE_STARTED: | 354 case VIDEO_CAPTURE_STATE_STARTED: |
| 358 base::ResetAndReturn(&running_callback_).Run(true); | 355 running_callback_.Run(true); |
| 359 break; | 356 break; |
| 360 | 357 |
| 361 case VIDEO_CAPTURE_STATE_STOPPING: | 358 case VIDEO_CAPTURE_STATE_STOPPING: |
| 362 case VIDEO_CAPTURE_STATE_STOPPED: | 359 case VIDEO_CAPTURE_STATE_STOPPED: |
| 363 case VIDEO_CAPTURE_STATE_ERROR: | 360 case VIDEO_CAPTURE_STATE_ERROR: |
| 364 case VIDEO_CAPTURE_STATE_ENDED: | 361 case VIDEO_CAPTURE_STATE_ENDED: |
| 365 base::ResetAndReturn(&running_callback_).Run(false); | 362 base::ResetAndReturn(&running_callback_).Run(false); |
| 366 break; | 363 break; |
| 367 | 364 |
| 368 case VIDEO_CAPTURE_STATE_PAUSED: | 365 case VIDEO_CAPTURE_STATE_PAUSED: |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 void MediaStreamVideoCapturerSource::OnStarted(bool result) { | 492 void MediaStreamVideoCapturerSource::OnStarted(bool result) { |
| 496 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); | 493 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); |
| 497 } | 494 } |
| 498 | 495 |
| 499 const char* | 496 const char* |
| 500 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { | 497 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { |
| 501 return kPowerLineFrequency; | 498 return kPowerLineFrequency; |
| 502 } | 499 } |
| 503 | 500 |
| 504 } // namespace content | 501 } // namespace content |
| OLD | NEW |