| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 running_callback_.Reset(); | 133 running_callback_.Reset(); |
| 134 source_formats_callback_.Reset(); | 134 source_formats_callback_.Reset(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void VideoCapturerDelegate::OnStateUpdateOnRenderThread( | 137 void VideoCapturerDelegate::OnStateUpdateOnRenderThread( |
| 138 VideoCaptureState state) { | 138 VideoCaptureState state) { |
| 139 DCHECK(thread_checker_.CalledOnValidThread()); | 139 DCHECK(thread_checker_.CalledOnValidThread()); |
| 140 DVLOG(3) << "OnStateUpdateOnRenderThread state = " << state; | 140 DVLOG(3) << "OnStateUpdateOnRenderThread state = " << state; |
| 141 if (state == VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { | 141 if (state == VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { |
| 142 running_callback_.Run(true); | 142 running_callback_.Run(MEDIA_DEVICE_OK); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 if (state > VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { | 145 if (state > VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) { |
| 146 base::ResetAndReturn(&running_callback_).Run(false); | 146 base::ResetAndReturn(&running_callback_).Run( |
| 147 MEDIA_DEVICE_TRACK_START_FAILURE); |
| 147 } | 148 } |
| 148 } | 149 } |
| 149 | 150 |
| 150 void VideoCapturerDelegate::OnDeviceFormatsInUseReceived( | 151 void VideoCapturerDelegate::OnDeviceFormatsInUseReceived( |
| 151 const media::VideoCaptureFormats& formats_in_use) { | 152 const media::VideoCaptureFormats& formats_in_use) { |
| 152 DVLOG(3) << "OnDeviceFormatsInUseReceived: " << formats_in_use.size(); | 153 DVLOG(3) << "OnDeviceFormatsInUseReceived: " << formats_in_use.size(); |
| 153 DCHECK(thread_checker_.CalledOnValidThread()); | 154 DCHECK(thread_checker_.CalledOnValidThread()); |
| 154 // StopCapture() might have destroyed |source_formats_callback_| before | 155 // StopCapture() might have destroyed |source_formats_callback_| before |
| 155 // arriving here. | 156 // arriving here. |
| 156 if (source_formats_callback_.is_null()) | 157 if (source_formats_callback_.is_null()) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 frame_callback, | 243 frame_callback, |
| 243 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, | 244 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, |
| 244 base::Unretained(this))); | 245 base::Unretained(this))); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void MediaStreamVideoCapturerSource::StopSourceImpl() { | 248 void MediaStreamVideoCapturerSource::StopSourceImpl() { |
| 248 delegate_->StopCapture(); | 249 delegate_->StopCapture(); |
| 249 } | 250 } |
| 250 | 251 |
| 251 } // namespace content | 252 } // namespace content |
| OLD | NEW |