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 20 matching lines...) Expand all Loading... |
31 const int kVideoFrameRates[] = {30, 60}; | 31 const int kVideoFrameRates[] = {30, 60}; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 VideoCapturerDelegate::VideoCapturerDelegate( | 37 VideoCapturerDelegate::VideoCapturerDelegate( |
38 const StreamDeviceInfo& device_info) | 38 const StreamDeviceInfo& device_info) |
39 : session_id_(device_info.session_id), | 39 : session_id_(device_info.session_id), |
40 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE || | 40 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE || |
41 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE), | 41 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { |
42 got_first_frame_(false) { | |
43 DVLOG(3) << "VideoCapturerDelegate::ctor"; | 42 DVLOG(3) << "VideoCapturerDelegate::ctor"; |
44 | 43 |
45 // NULL in unit test. | 44 // NULL in unit test. |
46 if (RenderThreadImpl::current()) { | 45 if (RenderThreadImpl::current()) { |
47 VideoCaptureImplManager* manager = | 46 VideoCaptureImplManager* manager = |
48 RenderThreadImpl::current()->video_capture_impl_manager(); | 47 RenderThreadImpl::current()->video_capture_impl_manager(); |
49 if (manager) | 48 if (manager) |
50 release_device_cb_ = manager->UseDevice(session_id_); | 49 release_device_cb_ = manager->UseDevice(session_id_); |
51 } | 50 } |
52 } | 51 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 &VideoCapturerDelegate::OnDeviceFormatsInUseReceived, this))); | 95 &VideoCapturerDelegate::OnDeviceFormatsInUseReceived, this))); |
97 } | 96 } |
98 | 97 |
99 void VideoCapturerDelegate::StartCapture( | 98 void VideoCapturerDelegate::StartCapture( |
100 const media::VideoCaptureParams& params, | 99 const media::VideoCaptureParams& params, |
101 const VideoCaptureDeliverFrameCB& new_frame_callback, | 100 const VideoCaptureDeliverFrameCB& new_frame_callback, |
102 const RunningCallback& running_callback) { | 101 const RunningCallback& running_callback) { |
103 DCHECK(params.requested_format.IsValid()); | 102 DCHECK(params.requested_format.IsValid()); |
104 DCHECK(thread_checker_.CalledOnValidThread()); | 103 DCHECK(thread_checker_.CalledOnValidThread()); |
105 running_callback_ = running_callback; | 104 running_callback_ = running_callback; |
106 got_first_frame_ = false; | |
107 | 105 |
108 // NULL in unit test. | 106 // NULL in unit test. |
109 if (!RenderThreadImpl::current()) | 107 if (!RenderThreadImpl::current()) |
110 return; | 108 return; |
111 VideoCaptureImplManager* manager = | 109 VideoCaptureImplManager* manager = |
112 RenderThreadImpl::current()->video_capture_impl_manager(); | 110 RenderThreadImpl::current()->video_capture_impl_manager(); |
113 if (!manager) | 111 if (!manager) |
114 return; | 112 return; |
115 stop_capture_cb_ = | 113 stop_capture_cb_ = |
116 manager->StartCapture( | 114 manager->StartCapture( |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 frame_callback, | 236 frame_callback, |
239 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, | 237 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, |
240 base::Unretained(this))); | 238 base::Unretained(this))); |
241 } | 239 } |
242 | 240 |
243 void MediaStreamVideoCapturerSource::StopSourceImpl() { | 241 void MediaStreamVideoCapturerSource::StopSourceImpl() { |
244 delegate_->StopCapture(); | 242 delegate_->StopCapture(); |
245 } | 243 } |
246 | 244 |
247 } // namespace content | 245 } // namespace content |
OLD | NEW |