From 79299afa3022560691068678bea711af3781eeb6 Mon Sep 17 00:00:00 2001 From: Alex Glaznev Date: Tue, 12 Apr 2016 16:39:39 -0700 Subject: [PATCH] Enable H.264 HW decoder soft rest. Also tune up scale thresholds a little. BUG=b/27674326 R=wzh@webrtc.org Review URL: https://codereview.webrtc.org/1879213002 . Cr-Commit-Position: refs/heads/master@{#12337} --- webrtc/api/java/jni/androidmediadecoder_jni.cc | 7 +++---- webrtc/api/java/jni/androidmediaencoder_jni.cc | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/webrtc/api/java/jni/androidmediadecoder_jni.cc b/webrtc/api/java/jni/androidmediadecoder_jni.cc index 9d66f830b0..c83be1818f 100644 --- a/webrtc/api/java/jni/androidmediadecoder_jni.cc +++ b/webrtc/api/java/jni/androidmediadecoder_jni.cc @@ -532,10 +532,9 @@ int32_t MediaCodecVideoDecoder::Decode( codec_.width = inputImage._encodedWidth; codec_.height = inputImage._encodedHeight; int32_t ret; - if (use_surface_ && codecType_ == kVideoCodecVP8) { - // Soft codec reset - only for VP8 and surface decoding. - // TODO(glaznev): try to use similar approach for H.264 - // and buffer decoding. + if (use_surface_ && + (codecType_ == kVideoCodecVP8 || codecType_ == kVideoCodecH264)) { + // Soft codec reset - only for surface decoding. ret = codec_thread_->Invoke(Bind( &MediaCodecVideoDecoder::ResetDecodeOnCodecThread, this)); } else { diff --git a/webrtc/api/java/jni/androidmediaencoder_jni.cc b/webrtc/api/java/jni/androidmediaencoder_jni.cc index dba71acac9..f4d8b9d238 100644 --- a/webrtc/api/java/jni/androidmediaencoder_jni.cc +++ b/webrtc/api/java/jni/androidmediaencoder_jni.cc @@ -377,15 +377,15 @@ int32_t MediaCodecVideoEncoder::InitEncode( // (internal) range: [0, 127]. And we cannot change QP_max in HW, so it is // always = 127. Note that in SW, QP is that of the user-level range [0, // 63]. - const int kLowQpThreshold = 32; - const int kBadQpThreshold = 92; + const int kLowQpThreshold = 29; + const int kBadQpThreshold = 90; quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, false, codec_settings->startBitrate, codec_settings->width, codec_settings->height); } else if (codecType_ == kVideoCodecH264) { // H264 QP is in the range [0, 51]. const int kLowQpThreshold = 21; - const int kBadQpThreshold = 36; + const int kBadQpThreshold = 33; quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, false, codec_settings->startBitrate, codec_settings->width, codec_settings->height);