Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: content/renderer/media/media_stream_video_capturer_source.cc

Issue 960103002: Rename VideoCaptureImplManager to VideoCaptureService Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix some nits Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_service.h"
11 #include "content/renderer/render_thread_impl.h" 11 #include "content/renderer/render_thread_impl.h"
12 #include "media/base/bind_to_current_loop.h" 12 #include "media/base/bind_to_current_loop.h"
13 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
14 14
15 namespace { 15 namespace {
16 16
17 struct SourceVideoResolution { 17 struct SourceVideoResolution {
18 int width; 18 int width;
19 int height; 19 int height;
20 }; 20 };
(...skipping 19 matching lines...) Expand all
40 VideoCapturerDelegate::VideoCapturerDelegate( 40 VideoCapturerDelegate::VideoCapturerDelegate(
41 const StreamDeviceInfo& device_info) 41 const StreamDeviceInfo& device_info)
42 : session_id_(device_info.session_id), 42 : session_id_(device_info.session_id),
43 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE || 43 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE ||
44 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE), 44 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE),
45 weak_factory_(this) { 45 weak_factory_(this) {
46 DVLOG(3) << "VideoCapturerDelegate::ctor"; 46 DVLOG(3) << "VideoCapturerDelegate::ctor";
47 47
48 // NULL in unit test. 48 // NULL in unit test.
49 if (RenderThreadImpl::current()) { 49 if (RenderThreadImpl::current()) {
50 VideoCaptureImplManager* manager = 50 VideoCaptureService* manager =
51 RenderThreadImpl::current()->video_capture_impl_manager(); 51 RenderThreadImpl::current()->video_capture_service();
52 if (manager) 52 if (manager)
53 release_device_cb_ = manager->UseDevice(session_id_); 53 release_device_cb_ = manager->UseDevice(session_id_);
54 } 54 }
55 } 55 }
56 56
57 VideoCapturerDelegate::~VideoCapturerDelegate() { 57 VideoCapturerDelegate::~VideoCapturerDelegate() {
58 DCHECK(thread_checker_.CalledOnValidThread()); 58 DCHECK(thread_checker_.CalledOnValidThread());
59 DVLOG(3) << "VideoCapturerDelegate::dtor"; 59 DVLOG(3) << "VideoCapturerDelegate::dtor";
60 if (!release_device_cb_.is_null()) 60 if (!release_device_cb_.is_null())
61 release_device_cb_.Run(); 61 release_device_cb_.Run();
(...skipping 19 matching lines...) Expand all
81 gfx::Size(width, height), 81 gfx::Size(width, height),
82 static_cast<float>(std::min(kMaxScreenCastFrameRate, 82 static_cast<float>(std::min(kMaxScreenCastFrameRate,
83 max_requested_frame_rate)), 83 max_requested_frame_rate)),
84 media::PIXEL_FORMAT_I420))); 84 media::PIXEL_FORMAT_I420)));
85 return; 85 return;
86 } 86 }
87 87
88 // NULL in unit test. 88 // NULL in unit test.
89 if (!RenderThreadImpl::current()) 89 if (!RenderThreadImpl::current())
90 return; 90 return;
91 VideoCaptureImplManager* manager = 91 VideoCaptureService* manager =
92 RenderThreadImpl::current()->video_capture_impl_manager(); 92 RenderThreadImpl::current()->video_capture_service();
93 if (!manager) 93 if (!manager)
94 return; 94 return;
95 DCHECK(source_formats_callback_.is_null()); 95 DCHECK(source_formats_callback_.is_null());
96 source_formats_callback_ = callback; 96 source_formats_callback_ = callback;
97 manager->GetDeviceFormatsInUse( 97 manager->GetDeviceFormatsInUse(
98 session_id_, 98 session_id_,
99 media::BindToCurrentLoop( 99 media::BindToCurrentLoop(
100 base::Bind( 100 base::Bind(
101 &VideoCapturerDelegate::OnDeviceFormatsInUseReceived, 101 &VideoCapturerDelegate::OnDeviceFormatsInUseReceived,
102 weak_factory_.GetWeakPtr()))); 102 weak_factory_.GetWeakPtr())));
103 } 103 }
104 104
105 void VideoCapturerDelegate::StartCapture( 105 void VideoCapturerDelegate::StartCapture(
106 const media::VideoCaptureParams& params, 106 const media::VideoCaptureParams& params,
107 const VideoCaptureDeliverFrameCB& new_frame_callback, 107 const VideoCaptureDeliverFrameCB& new_frame_callback,
108 scoped_refptr<base::SingleThreadTaskRunner> frame_callback_task_runner, 108 scoped_refptr<base::SingleThreadTaskRunner> frame_callback_task_runner,
109 const RunningCallback& running_callback) { 109 const RunningCallback& running_callback) {
110 DCHECK(params.requested_format.IsValid()); 110 DCHECK(params.requested_format.IsValid());
111 DCHECK(thread_checker_.CalledOnValidThread()); 111 DCHECK(thread_checker_.CalledOnValidThread());
112 running_callback_ = running_callback; 112 running_callback_ = running_callback;
113 113
114 // NULL in unit test. 114 // NULL in unit test.
115 if (!RenderThreadImpl::current()) 115 if (!RenderThreadImpl::current())
116 return; 116 return;
117 VideoCaptureImplManager* manager = 117 VideoCaptureService* manager =
118 RenderThreadImpl::current()->video_capture_impl_manager(); 118 RenderThreadImpl::current()->video_capture_service();
119 if (!manager) 119 if (!manager)
120 return; 120 return;
121 if (frame_callback_task_runner != 121 if (frame_callback_task_runner !=
122 RenderThreadImpl::current()->GetIOMessageLoopProxy()) { 122 RenderThreadImpl::current()->GetIOMessageLoopProxy()) {
123 DCHECK(false) << "Only IO thread supported right now."; 123 DCHECK(false) << "Only IO thread supported right now.";
124 running_callback.Run(false); 124 running_callback.Run(false);
125 return; 125 return;
126 } 126 }
127 127
128 stop_capture_cb_ = 128 stop_capture_cb_ =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // supported form. 171 // supported form.
172 if (!formats_in_use.empty()) { 172 if (!formats_in_use.empty()) {
173 source_formats_callback_.Run(formats_in_use); 173 source_formats_callback_.Run(formats_in_use);
174 source_formats_callback_.Reset(); 174 source_formats_callback_.Reset();
175 return; 175 return;
176 } 176 }
177 177
178 // NULL in unit test. 178 // NULL in unit test.
179 if (!RenderThreadImpl::current()) 179 if (!RenderThreadImpl::current())
180 return; 180 return;
181 VideoCaptureImplManager* manager = 181 VideoCaptureService* manager =
182 RenderThreadImpl::current()->video_capture_impl_manager(); 182 RenderThreadImpl::current()->video_capture_service();
183 if (!manager) 183 if (!manager)
184 return; 184 return;
185 185
186 manager->GetDeviceSupportedFormats( 186 manager->GetDeviceSupportedFormats(
187 session_id_, 187 session_id_,
188 media::BindToCurrentLoop( 188 media::BindToCurrentLoop(
189 base::Bind( 189 base::Bind(
190 &VideoCapturerDelegate::OnDeviceSupportedFormatsEnumerated, 190 &VideoCapturerDelegate::OnDeviceSupportedFormatsEnumerated,
191 weak_factory_.GetWeakPtr()))); 191 weak_factory_.GetWeakPtr())));
192 } 192 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 void MediaStreamVideoCapturerSource::OnStarted(bool result) { 267 void MediaStreamVideoCapturerSource::OnStarted(bool result) {
268 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE); 268 OnStartDone(result ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE);
269 } 269 }
270 270
271 void MediaStreamVideoCapturerSource::StopSourceImpl() { 271 void MediaStreamVideoCapturerSource::StopSourceImpl() {
272 delegate_->StopCapture(); 272 delegate_->StopCapture();
273 } 273 }
274 274
275 } // namespace content 275 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698