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

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

Issue 1732083002: VideoTrackRecorder: limit VP9 cpu usage and quality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: miu@s comments Created 4 years, 10 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
« no previous file with comments | « no previous file | content/renderer/media/video_track_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/video_track_recorder.cc
diff --git a/content/renderer/media/video_track_recorder.cc b/content/renderer/media/video_track_recorder.cc
index 82ae3ea9ba7dc9ed25e19f9277f1e0fd758de253..1c70fd8e5bcd10114cde130ad0b7f6cb6085b645 100644
--- a/content/renderer/media/video_track_recorder.cc
+++ b/content/renderer/media/video_track_recorder.cc
@@ -260,9 +260,8 @@ void VideoTrackRecorder::VpxEncoder::ConfigureEncoding(const gfx::Size& size) {
const vpx_codec_iface_t* interface =
use_vp9_ ? vpx_codec_vp9_cx() : vpx_codec_vp8_cx();
- const vpx_codec_err_t result = vpx_codec_enc_config_default(interface,
- &codec_config_,
- 0 /* reserved */);
+ vpx_codec_err_t result =
+ vpx_codec_enc_config_default(interface, &codec_config_, 0 /* reserved */);
DCHECK_EQ(VPX_CODEC_OK, result);
DCHECK_EQ(320u, codec_config_.g_w);
@@ -285,6 +284,13 @@ void VideoTrackRecorder::VpxEncoder::ConfigureEncoding(const gfx::Size& size) {
// DCHECK that the profile selected by default is I420 (magic number 0).
DCHECK_EQ(0u, codec_config_.g_profile);
+
+ // Request the lowest-CPU usage that VP9 supports while keeping a certain
+ // quality. Values greater than 0 will increase encoder speed at the expense
+ // of quality. Note: this is configured via the same parameter as for VP8.
+ const int kCpuUsage = 10;
miu 2016/02/26 19:27:49 It's important you understand what this does: Inte
mcasas 2016/02/26 22:18:22 Hmmm talking about implementation details leaking.
+ result = vpx_codec_control(encoder_.get(), VP8E_SET_CPUUSED, kCpuUsage);
+ DLOG_IF(WARNING, VPX_CODEC_OK != result) << "Failed to set CPUUSED";
} else {
// VP8 always produces frames instantaneously.
DCHECK_EQ(0u, codec_config_.g_lag_in_frames);
« no previous file with comments | « no previous file | content/renderer/media/video_track_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698