| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 else | 191 else |
| 192 source_->MaybeSuspend(); | 192 source_->MaybeSuspend(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void MediaStreamVideoCapturerSource::OnCapturingLinkSecured(bool is_secure) { | 195 void MediaStreamVideoCapturerSource::OnCapturingLinkSecured(bool is_secure) { |
| 196 Send(new MediaStreamHostMsg_SetCapturingLinkSecured( | 196 Send(new MediaStreamHostMsg_SetCapturingLinkSecured( |
| 197 device_info().session_id, device_info().device.type, is_secure)); | 197 device_info().session_id, device_info().device.type, is_secure)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void MediaStreamVideoCapturerSource::StartSourceImpl( | 200 void MediaStreamVideoCapturerSource::StartSourceImpl( |
| 201 const media::VideoCaptureFormat& format, | |
| 202 const blink::WebMediaConstraints& constraints, | |
| 203 const VideoCaptureDeliverFrameCB& frame_callback) { | 201 const VideoCaptureDeliverFrameCB& frame_callback) { |
| 204 is_capture_starting_ = true; | 202 is_capture_starting_ = true; |
| 205 source_->StartCapture( | 203 source_->StartCapture( |
| 206 capture_params_, frame_callback, | 204 capture_params_, frame_callback, |
| 207 base::Bind(&MediaStreamVideoCapturerSource::OnRunStateChanged, | 205 base::Bind(&MediaStreamVideoCapturerSource::OnRunStateChanged, |
| 208 base::Unretained(this))); | 206 base::Unretained(this))); |
| 209 } | 207 } |
| 210 | 208 |
| 211 void MediaStreamVideoCapturerSource::StopSourceImpl() { | 209 void MediaStreamVideoCapturerSource::StopSourceImpl() { |
| 212 source_->StopCapture(); | 210 source_->StopCapture(); |
| 213 } | 211 } |
| 214 | 212 |
| 215 base::Optional<media::VideoCaptureFormat> | 213 base::Optional<media::VideoCaptureFormat> |
| 216 MediaStreamVideoCapturerSource::GetCurrentFormatImpl() const { | 214 MediaStreamVideoCapturerSource::GetCurrentFormatImpl() const { |
| 217 return base::Optional<media::VideoCaptureFormat>( | 215 return base::Optional<media::VideoCaptureFormat>( |
| 218 capture_params_.requested_format); | 216 capture_params_.requested_format); |
| 219 } | 217 } |
| 220 | 218 |
| 221 void MediaStreamVideoCapturerSource::OnRunStateChanged(bool is_running) { | 219 void MediaStreamVideoCapturerSource::OnRunStateChanged(bool is_running) { |
| 222 if (is_capture_starting_) { | 220 if (is_capture_starting_) { |
| 223 OnStartDone(is_running ? MEDIA_DEVICE_OK | 221 OnStartDone(is_running ? MEDIA_DEVICE_OK |
| 224 : MEDIA_DEVICE_TRACK_START_FAILURE); | 222 : MEDIA_DEVICE_TRACK_START_FAILURE); |
| 225 is_capture_starting_ = false; | 223 is_capture_starting_ = false; |
| 226 } else if (!is_running) { | 224 } else if (!is_running) { |
| 227 StopSource(); | 225 StopSource(); |
| 228 } | 226 } |
| 229 } | 227 } |
| 230 | 228 |
| 231 } // namespace content | 229 } // namespace content |
| OLD | NEW |