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

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

Issue 311363002: Accept up to 60fps frame rate in MediaStreamVideoCapturerSource (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl_manager.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 SourceVideoFormat { 17 struct SourceVideoResolution {
18 int width; 18 int width;
19 int height; 19 int height;
20 int frame_rate;
21 }; 20 };
22 21
23 // List of formats used if the source doesn't support capability enumeration. 22 // Resolutions used if the source doesn't support capability enumeration.
24 const SourceVideoFormat kVideoFormats[] = {{1920, 1080, 30}, 23 const SourceVideoResolution kVideoResolutions[] = {{1920, 1080},
25 {1280, 720, 30}, 24 {1280, 720},
26 {960, 720, 30}, 25 {960, 720},
27 {640, 480, 30}, 26 {640, 480},
28 {640, 360, 30}, 27 {640, 360},
29 {320, 240, 30}, 28 {320, 240},
30 {320, 180, 30}}; 29 {320, 180}};
30 // Frame rates for sources with no support for capability enumeration.
31 const int kVideoFrameRates[] = {30, 60};
31 32
32 } // namespace 33 } // namespace
33 34
34 namespace content { 35 namespace content {
35 36
36 VideoCapturerDelegate::VideoCapturerDelegate( 37 VideoCapturerDelegate::VideoCapturerDelegate(
37 const StreamDeviceInfo& device_info) 38 const StreamDeviceInfo& device_info)
38 : session_id_(device_info.session_id), 39 : session_id_(device_info.session_id),
39 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE || 40 is_screen_cast_(device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE ||
40 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE), 41 device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE),
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // StopCapture() might have destroyed |source_formats_callback_| before 184 // StopCapture() might have destroyed |source_formats_callback_| before
184 // arriving here. 185 // arriving here.
185 if (source_formats_callback_.is_null()) 186 if (source_formats_callback_.is_null())
186 return; 187 return;
187 if (formats.size()) { 188 if (formats.size()) {
188 source_formats_callback_.Run(formats); 189 source_formats_callback_.Run(formats);
189 } else { 190 } else {
190 // The capture device doesn't seem to support capability enumeration, 191 // The capture device doesn't seem to support capability enumeration,
191 // compose a fallback list of capabilities. 192 // compose a fallback list of capabilities.
192 media::VideoCaptureFormats default_formats; 193 media::VideoCaptureFormats default_formats;
193 for (size_t i = 0; i < arraysize(kVideoFormats); ++i) { 194 for (size_t i = 0; i < arraysize(kVideoResolutions); ++i) {
194 default_formats.push_back(media::VideoCaptureFormat( 195 for (size_t j = 0; j < arraysize(kVideoFrameRates); ++j) {
195 gfx::Size(kVideoFormats[i].width, kVideoFormats[i].height), 196 default_formats.push_back(media::VideoCaptureFormat(
196 kVideoFormats[i].frame_rate, 197 gfx::Size(kVideoResolutions[i].width, kVideoResolutions[i].height),
197 media::PIXEL_FORMAT_I420)); 198 kVideoFrameRates[j], media::PIXEL_FORMAT_I420));
199 }
198 } 200 }
199 source_formats_callback_.Run(default_formats); 201 source_formats_callback_.Run(default_formats);
200 } 202 }
201 source_formats_callback_.Reset(); 203 source_formats_callback_.Reset();
202 } 204 }
203 205
204 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource( 206 MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource(
205 const StreamDeviceInfo& device_info, 207 const StreamDeviceInfo& device_info,
206 const SourceStoppedCallback& stop_callback, 208 const SourceStoppedCallback& stop_callback,
207 const scoped_refptr<VideoCapturerDelegate>& delegate) 209 const scoped_refptr<VideoCapturerDelegate>& delegate)
(...skipping 28 matching lines...) Expand all
236 frame_callback, 238 frame_callback,
237 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone, 239 base::Bind(&MediaStreamVideoCapturerSource::OnStartDone,
238 base::Unretained(this))); 240 base::Unretained(this)));
239 } 241 }
240 242
241 void MediaStreamVideoCapturerSource::StopSourceImpl() { 243 void MediaStreamVideoCapturerSource::StopSourceImpl() {
242 delegate_->StopCapture(); 244 delegate_->StopCapture();
243 } 245 }
244 246
245 } // namespace content 247 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698