| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 public: | 202 public: |
| 203 explicit LocalVideoCapturerSource(const StreamDeviceInfo& device_info); | 203 explicit LocalVideoCapturerSource(const StreamDeviceInfo& device_info); |
| 204 ~LocalVideoCapturerSource() override; | 204 ~LocalVideoCapturerSource() override; |
| 205 | 205 |
| 206 // VideoCaptureDelegate Implementation. | 206 // VideoCaptureDelegate Implementation. |
| 207 void GetCurrentSupportedFormats( | 207 void GetCurrentSupportedFormats( |
| 208 int max_requested_width, | 208 int max_requested_width, |
| 209 int max_requested_height, | 209 int max_requested_height, |
| 210 double max_requested_frame_rate, | 210 double max_requested_frame_rate, |
| 211 const VideoCaptureDeviceFormatsCB& callback) override; | 211 const VideoCaptureDeviceFormatsCB& callback) override; |
| 212 media::VideoCaptureFormats GetPreferredFormats() override; |
| 212 void StartCapture(const media::VideoCaptureParams& params, | 213 void StartCapture(const media::VideoCaptureParams& params, |
| 213 const VideoCaptureDeliverFrameCB& new_frame_callback, | 214 const VideoCaptureDeliverFrameCB& new_frame_callback, |
| 214 const RunningCallback& running_callback) override; | 215 const RunningCallback& running_callback) override; |
| 215 void RequestRefreshFrame() override; | 216 void RequestRefreshFrame() override; |
| 216 void MaybeSuspend() override; | 217 void MaybeSuspend() override; |
| 217 void Resume() override; | 218 void Resume() override; |
| 218 void StopCapture() override; | 219 void StopCapture() override; |
| 219 | 220 |
| 220 private: | 221 private: |
| 221 void OnStateUpdate(VideoCaptureState state); | 222 void OnStateUpdate(VideoCaptureState state); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 295 } |
| 295 | 296 |
| 296 DCHECK(formats_enumerated_callback_.is_null()); | 297 DCHECK(formats_enumerated_callback_.is_null()); |
| 297 formats_enumerated_callback_ = callback; | 298 formats_enumerated_callback_ = callback; |
| 298 manager_->GetDeviceFormatsInUse( | 299 manager_->GetDeviceFormatsInUse( |
| 299 session_id_, media::BindToCurrentLoop(base::Bind( | 300 session_id_, media::BindToCurrentLoop(base::Bind( |
| 300 &LocalVideoCapturerSource::OnDeviceFormatsInUseReceived, | 301 &LocalVideoCapturerSource::OnDeviceFormatsInUseReceived, |
| 301 weak_factory_.GetWeakPtr()))); | 302 weak_factory_.GetWeakPtr()))); |
| 302 } | 303 } |
| 303 | 304 |
| 305 media::VideoCaptureFormats LocalVideoCapturerSource::GetPreferredFormats() { |
| 306 return media::VideoCaptureFormats(); |
| 307 } |
| 308 |
| 304 void LocalVideoCapturerSource::StartCapture( | 309 void LocalVideoCapturerSource::StartCapture( |
| 305 const media::VideoCaptureParams& params, | 310 const media::VideoCaptureParams& params, |
| 306 const VideoCaptureDeliverFrameCB& new_frame_callback, | 311 const VideoCaptureDeliverFrameCB& new_frame_callback, |
| 307 const RunningCallback& running_callback) { | 312 const RunningCallback& running_callback) { |
| 308 DCHECK(params.requested_format.IsValid()); | 313 DCHECK(params.requested_format.IsValid()); |
| 309 DCHECK(thread_checker_.CalledOnValidThread()); | 314 DCHECK(thread_checker_.CalledOnValidThread()); |
| 310 running_callback_ = running_callback; | 315 running_callback_ = running_callback; |
| 311 | 316 |
| 312 stop_capture_cb_ = manager_->StartCapture( | 317 stop_capture_cb_ = manager_->StartCapture( |
| 313 session_id_, params, media::BindToCurrentLoop(base::Bind( | 318 session_id_, params, media::BindToCurrentLoop(base::Bind( |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 StopSource(); | 507 StopSource(); |
| 503 } | 508 } |
| 504 } | 509 } |
| 505 | 510 |
| 506 const char* | 511 const char* |
| 507 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { | 512 MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { |
| 508 return kPowerLineFrequency; | 513 return kPowerLineFrequency; |
| 509 } | 514 } |
| 510 | 515 |
| 511 } // namespace content | 516 } // namespace content |
| OLD | NEW |