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

Unified Diff: content/renderer/media/media_stream_video_capturer_source.cc

Issue 442643002: Allow MediaStream constraints to specify higher than 30 FPS tab capture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile whoops. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_video_capturer_source.cc
diff --git a/content/renderer/media/media_stream_video_capturer_source.cc b/content/renderer/media/media_stream_video_capturer_source.cc
index 1266853362bb6f4274a4ab27b1d686c9d2690440..d322eb4051c61ee5a0f79c832e8b42ab089389bb 100644
--- a/content/renderer/media/media_stream_video_capturer_source.cc
+++ b/content/renderer/media/media_stream_video_capturer_source.cc
@@ -30,6 +30,9 @@ const SourceVideoResolution kVideoResolutions[] = {{1920, 1080},
// Frame rates for sources with no support for capability enumeration.
const int kVideoFrameRates[] = {30, 60};
+// Hard upper-bound frame rate for tab/desktop capture.
+const double kMaxScreenCastFrameRate = 120.0;
+
} // namespace
namespace content {
@@ -59,23 +62,24 @@ VideoCapturerDelegate::~VideoCapturerDelegate() {
void VideoCapturerDelegate::GetCurrentSupportedFormats(
int max_requested_width,
int max_requested_height,
+ double max_requested_frame_rate,
const VideoCaptureDeviceFormatsCB& callback) {
- DVLOG(3) << "GetCurrentSupportedFormats("
- << " { max_requested_height = " << max_requested_height << "})"
- << " { max_requested_width = " << max_requested_width << "})";
+ DVLOG(3)
+ << "GetCurrentSupportedFormats("
+ << " { max_requested_height = " << max_requested_height << "})"
+ << " { max_requested_width = " << max_requested_width << "})"
+ << " { max_requested_frame_rate = " << max_requested_frame_rate << "})";
if (is_screen_cast_) {
- media::VideoCaptureFormats formats;
const int width = max_requested_width ?
max_requested_width : MediaStreamVideoSource::kDefaultWidth;
const int height = max_requested_height ?
max_requested_height : MediaStreamVideoSource::kDefaultHeight;
- formats.push_back(
- media::VideoCaptureFormat(
- gfx::Size(width, height),
- MediaStreamVideoSource::kDefaultFrameRate,
- media::PIXEL_FORMAT_I420));
- callback.Run(formats);
+ callback.Run(media::VideoCaptureFormats(1, media::VideoCaptureFormat(
+ gfx::Size(width, height),
+ static_cast<float>(std::min(kMaxScreenCastFrameRate,
+ max_requested_frame_rate)),
+ media::PIXEL_FORMAT_I420)));
return;
}
@@ -216,10 +220,12 @@ MediaStreamVideoCapturerSource::~MediaStreamVideoCapturerSource() {
void MediaStreamVideoCapturerSource::GetCurrentSupportedFormats(
int max_requested_width,
int max_requested_height,
+ double max_requested_frame_rate,
const VideoCaptureDeviceFormatsCB& callback) {
delegate_->GetCurrentSupportedFormats(
max_requested_width,
max_requested_height,
+ max_requested_frame_rate,
callback);
}
« no previous file with comments | « content/renderer/media/media_stream_video_capturer_source.h ('k') | content/renderer/media/media_stream_video_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698