MediaCodecVideoEncoder: Add QP stats to Encoded callback for VP9 and turn on quality scaling.

Add default QP scaling thresholds for VP9.

BUG=webrtc:7662

Review-Url: https://codereview.webrtc.org/2914363002
Cr-Commit-Position: refs/heads/master@{#18469}
This commit is contained in:
asapersson
2017-06-07 04:09:45 -07:00
committed by Commit Bot
parent 3e35a3cfd9
commit 1e15a994ac
4 changed files with 22 additions and 2 deletions

View File

@ -4,6 +4,7 @@ include_rules = [
"+webrtc/common_video/libyuv/include/webrtc_libyuv.h",
"+webrtc/modules/utility/include/jvm_android.h",
"+webrtc/modules/video_coding/utility/vp8_header_parser.h",
"+webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h",
"+webrtc/pc",
"+webrtc/system_wrappers/include/field_trial_default.h",
]

View File

@ -39,6 +39,7 @@
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/modules/video_coding/utility/quality_scaler.h"
#include "webrtc/modules/video_coding/utility/vp8_header_parser.h"
#include "webrtc/modules/video_coding/utility/vp9_uncompressed_header_parser.h"
#include "webrtc/sdk/android/src/jni/androidmediacodeccommon.h"
#include "webrtc/sdk/android/src/jni/classreferenceholder.h"
#include "webrtc/sdk/android/src/jni/native_handle_impl.h"
@ -404,12 +405,14 @@ int32_t MediaCodecVideoEncoder::InitEncode(
codec_mode_ = codec_settings->mode;
int init_width = codec_settings->width;
int init_height = codec_settings->height;
// Scaling is disabled for VP9, but optionally enabled for VP8.
// Scaling is optionally enabled for VP8 and VP9.
// TODO(pbos): Extract automaticResizeOn out of VP8 settings.
scale_ = false;
if (codec_type == kVideoCodecVP8) {
scale_ = codec_settings->VP8().automaticResizeOn;
} else if (codec_type != kVideoCodecVP9) {
} else if (codec_type == kVideoCodecVP9) {
scale_ = codec_settings->VP9().automaticResizeOn;
} else {
scale_ = true;
}
@ -1104,6 +1107,12 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) {
current_acc_qp_ += qp;
image->qp_ = qp;
}
} else if (codec_type == kVideoCodecVP9) {
int qp;
if (webrtc::vp9::GetQp(payload, payload_size, &qp)) {
current_acc_qp_ += qp;
image->qp_ = qp;
}
}
} else if (codec_type == kVideoCodecH264) {
h264_bitstream_parser_.ParseBitstream(payload, payload_size);