| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "content/renderer/media/video_capture_impl_manager.h" | 10 #include "content/renderer/media/video_capture_impl_manager.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 running_callback_.Reset(); | 129 running_callback_.Reset(); |
| 130 source_formats_callback_.Reset(); | 130 source_formats_callback_.Reset(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void VideoCapturerDelegate::OnStateUpdateOnRenderThread( | 133 void VideoCapturerDelegate::OnStateUpdateOnRenderThread( |
| 134 VideoCaptureState state) { | 134 VideoCaptureState state) { |
| 135 DCHECK(thread_checker_.CalledOnValidThread()); | 135 DCHECK(thread_checker_.CalledOnValidThread()); |
| 136 DVLOG(3) << "OnStateUpdateOnRenderThread state = " << state; | 136 DVLOG(3) << "OnStateUpdateOnRenderThread state = " << state; |
| 137 if (state == VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { | 137 if (state == VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { |
| 138 running_callback_.Run(true); | 138 running_callback_.Run(MEDIA_DEVICE_OK); |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 if (state > VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { | 141 if (state > VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { |
| 142 base::ResetAndReturn(&running_callback_).Run(false); | 142 base::ResetAndReturn(&running_callback_).Run( |
| 143 MEDIA_DEVICE_TRACK_START_FAILURE); |
| 143 } | 144 } |
| 144 } | 145 } |
| 145 | 146 |
| 146 void VideoCapturerDelegate::OnDeviceFormatsInUseReceived( | 147 void VideoCapturerDelegate::OnDeviceFormatsInUseReceived( |
| 147 const media::VideoCaptureFormats& formats_in_use) { | 148 const media::VideoCaptureFormats& formats_in_use) { |
| 148 DVLOG(3) << "OnDeviceFormatsInUseReceived: " << formats_in_use.size(); | 149 DVLOG(3) << "OnDeviceFormatsInUseReceived: " << formats_in_use.size(); |
| 149 DCHECK(thread_checker_.CalledOnValidThread()); | 150 DCHECK(thread_checker_.CalledOnValidThread()); |
| 150 // StopCapture() might have destroyed |source_formats_callback_| before | 151 // StopCapture() might have destroyed |source_formats_callback_| before |
| 151 // arriving here. | 152 // arriving here. |
| 152 if (source_formats_callback_.is_null()) | 153 if (source_formats_callback_.is_null()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 frame_callback, | 237 frame_callback, |
| 237 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, | 238 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, |
| 238 base::Unretained(this))); | 239 base::Unretained(this))); |
| 239 } | 240 } |
| 240 | 241 |
| 241 void MediaStreamVideoCapturerSource::StopSourceImpl() { | 242 void MediaStreamVideoCapturerSource::StopSourceImpl() { |
| 242 delegate_->StopCapture(); | 243 delegate_->StopCapture(); |
| 243 } | 244 } |
| 244 | 245 |
| 245 } // namespace content | 246 } // namespace content |
| OLD | NEW |