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

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

Issue 1814973002: MediaRecorder: Tune complexity settings for VP9 encoding (second go) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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..718ab145bfbef7baee409f54af4b88532fbd9477 100644
--- a/content/renderer/media/video_track_recorder.cc
+++ b/content/renderer/media/video_track_recorder.cc
@@ -325,6 +325,17 @@ void VideoTrackRecorder::VpxEncoder::ConfigureEncoding(const gfx::Size& size) {
const vpx_codec_err_t ret = vpx_codec_enc_init(encoder_.get(), interface,
&codec_config_, kNoFlags);
DCHECK_EQ(VPX_CODEC_OK, ret);
+
+ if (use_vp9_) {
+ // Values of VP8E_SET_CPUUSED greater than 0 will increase encoder speed at
+ // the expense of quality up to a maximum value of 8 for VP9, by tuning the
+ // target time spent encoding the frame. Go from 8 to 5 (values for real
+ // time encoding) depending on the amount of cores available in the system.
+ const int kCpuUsed =
+ std::max(5, 8 - base::SysInfo::NumberOfProcessors() / 2);
+ result = vpx_codec_control(encoder_.get(), VP8E_SET_CPUUSED, kCpuUsed);
+ DLOG_IF(WARNING, VPX_CODEC_OK != result) << "VP8E_SET_CPUUSED failed";
+ }
}
bool VideoTrackRecorder::VpxEncoder::IsInitialized() const {
« 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