From b7a2c273f108608748d6b126088e7aa7b78b205b Mon Sep 17 00:00:00 2001
From: wez <wez@chromium.org>
Date: Fri, 29 Aug 2014 12:22:35 -0700
Subject: Switch VP9 lossy encode to CPUUSED=7 and use it by default.

Lossy encoding is now reliable enough to be enabled by default when running with VP9.

BUG=260879

Review URL: https://codereview.chromium.org/421793003

Cr-Commit-Position: refs/heads/master@{#292680}
---
 remoting/codec/video_encoder_vpx.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

(limited to 'remoting')

diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc
index 62abc4a..75b6d4e 100644
--- a/remoting/codec/video_encoder_vpx.cc
+++ b/remoting/codec/video_encoder_vpx.cc
@@ -133,9 +133,11 @@ ScopedVpxCodec CreateVP9Codec(const webrtc::DesktopSize& size,
   if (vpx_codec_enc_init(codec.get(), algo, &config, 0))
     return ScopedVpxCodec();
 
-  // Request the lowest-CPU encode feature-set that VP9 supports.
+  // Request the lowest-CPU usage that VP9 supports, which depends on whether
+  // we are encoding lossy or lossless.
   // Note that this is configured via the same parameter as for VP8.
-  if (vpx_codec_control(codec.get(), VP8E_SET_CPUUSED, 5))
+  int cpu_used = lossless_encode ? 5 : 7;
+  if (vpx_codec_control(codec.get(), VP8E_SET_CPUUSED, cpu_used))
     return ScopedVpxCodec();
 
   // Use the lowest level of noise sensitivity so as to spend less time
@@ -334,9 +336,6 @@ VideoEncoderVpx::VideoEncoderVpx(bool use_vp9)
       active_map_width_(0),
       active_map_height_(0) {
   if (use_vp9_) {
-    // Use lossless encoding mode by default.
-    SetLosslessEncode(true);
-
     // Use I444 colour space, by default, if specified on the command-line.
     if (CommandLine::ForCurrentProcess()->HasSwitch(kEnableI444SwitchName)) {
       SetLosslessColor(true);
-- 
cgit v1.1