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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // VideoCaptureDelegate Implementation. | 204 // VideoCaptureDelegate Implementation. |
205 void GetCurrentSupportedFormats( | 205 void GetCurrentSupportedFormats( |
206 int max_requested_width, | 206 int max_requested_width, |
207 int max_requested_height, | 207 int max_requested_height, |
208 double max_requested_frame_rate, | 208 double max_requested_frame_rate, |
209 const VideoCaptureDeviceFormatsCB& callback) override; | 209 const VideoCaptureDeviceFormatsCB& callback) override; |
210 void StartCapture(const media::VideoCaptureParams& params, | 210 void StartCapture(const media::VideoCaptureParams& params, |
211 const VideoCaptureDeliverFrameCB& new_frame_callback, | 211 const VideoCaptureDeliverFrameCB& new_frame_callback, |
212 const RunningCallback& running_callback) override; | 212 const RunningCallback& running_callback) override; |
213 void RequestRefreshFrame() override; | 213 void RequestRefreshFrame() override; |
| 214 void SetCapturingLinkSecured(bool is_secure) override; |
214 void StopCapture() override; | 215 void StopCapture() override; |
215 | 216 |
216 private: | 217 private: |
217 void OnStateUpdate(VideoCaptureState state); | 218 void OnStateUpdate(VideoCaptureState state); |
218 void OnDeviceFormatsInUseReceived(const media::VideoCaptureFormats& formats); | 219 void OnDeviceFormatsInUseReceived(const media::VideoCaptureFormats& formats); |
219 void OnDeviceSupportedFormatsEnumerated( | 220 void OnDeviceSupportedFormatsEnumerated( |
220 const media::VideoCaptureFormats& formats); | 221 const media::VideoCaptureFormats& formats); |
221 | 222 |
222 // |session_id_| identifies the capture device used for this capture session. | 223 // |session_id_| identifies the capture device used for this capture session. |
223 const media::VideoCaptureSessionId session_id_; | 224 const media::VideoCaptureSessionId session_id_; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 312 } |
312 | 313 |
313 void LocalVideoCapturerSource::RequestRefreshFrame() { | 314 void LocalVideoCapturerSource::RequestRefreshFrame() { |
314 DVLOG(3) << __FUNCTION__; | 315 DVLOG(3) << __FUNCTION__; |
315 DCHECK(thread_checker_.CalledOnValidThread()); | 316 DCHECK(thread_checker_.CalledOnValidThread()); |
316 if (stop_capture_cb_.is_null()) | 317 if (stop_capture_cb_.is_null()) |
317 return; // Do not request frames if the source is stopped. | 318 return; // Do not request frames if the source is stopped. |
318 manager_->RequestRefreshFrame(session_id_); | 319 manager_->RequestRefreshFrame(session_id_); |
319 } | 320 } |
320 | 321 |
| 322 void LocalVideoCapturerSource::SetCapturingLinkSecured(bool is_secure) { |
| 323 DCHECK(thread_checker_.CalledOnValidThread()); |
| 324 manager_->SetCapturingLinkSecured(session_id_, is_secure); |
| 325 } |
321 | 326 |
322 void LocalVideoCapturerSource::StopCapture() { | 327 void LocalVideoCapturerSource::StopCapture() { |
323 DVLOG(3) << __FUNCTION__; | 328 DVLOG(3) << __FUNCTION__; |
324 DCHECK(thread_checker_.CalledOnValidThread()); | 329 DCHECK(thread_checker_.CalledOnValidThread()); |
325 // Immediately make sure we don't provide more frames. | 330 // Immediately make sure we don't provide more frames. |
326 if (!stop_capture_cb_.is_null()) | 331 if (!stop_capture_cb_.is_null()) |
327 base::ResetAndReturn(&stop_capture_cb_).Run(); | 332 base::ResetAndReturn(&stop_capture_cb_).Run(); |
328 running_callback_.Reset(); | 333 running_callback_.Reset(); |
329 // Invalidate any potential format enumerations going on. | 334 // Invalidate any potential format enumerations going on. |
330 formats_enumerated_callback_.Reset(); | 335 formats_enumerated_callback_.Reset(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 SetDeviceInfo(device_info); | 410 SetDeviceInfo(device_info); |
406 } | 411 } |
407 | 412 |
408 MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() { | 413 MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() { |
409 } | 414 } |
410 | 415 |
411 void MediaStreamVideoCapturerSource::RequestRefreshFrame() { | 416 void MediaStreamVideoCapturerSource::RequestRefreshFrame() { |
412 source_->RequestRefreshFrame(); | 417 source_->RequestRefreshFrame(); |
413 } | 418 } |
414 | 419 |
| 420 void MediaStreamVideoCapturerSource::SetCapturingLinkSecured(bool is_secure) { |
| 421 source_->SetCapturingLinkSecured(is_secure); |
| 422 } |
| 423 |
415 void MediaStreamVideoCapturerSource::GetCurrentSupportedFormats( | 424 void MediaStreamVideoCapturerSource::GetCurrentSupportedFormats( |
416 int max_requested_width, | 425 int max_requested_width, |
417 int max_requested_height, | 426 int max_requested_height, |
418 double max_requested_frame_rate, | 427 double max_requested_frame_rate, |
419 const VideoCaptureDeviceFormatsCB& callback) { | 428 const VideoCaptureDeviceFormatsCB& callback) { |
420 source_->GetCurrentSupportedFormats( | 429 source_->GetCurrentSupportedFormats( |
421 max_requested_width, | 430 max_requested_width, |
422 max_requested_height, | 431 max_requested_height, |
423 max_requested_frame_rate, | 432 max_requested_frame_rate, |
424 callback); | 433 callback); |
(...skipping 25 matching lines...) Expand all Loading... |
450 void MediaStreamVideoCapturerSource::OnStarted(bool result) { | 459 void MediaStreamVideoCapturerSource::OnStarted(bool result) { |
451 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); | 460 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); |
452 } | 461 } |
453 | 462 |
454 const char* | 463 const char* |
455 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { | 464 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { |
456 return kPowerLineFrequency; | 465 return kPowerLineFrequency; |
457 } | 466 } |
458 | 467 |
459 } // namespace content | 468 } // namespace content |
OLD | NEW |