From 4478d9b7733de49973f42a35fc47374d570a47c3 Mon Sep 17 00:00:00 2001 From: Rasmus Brandt Date: Tue, 17 Apr 2018 13:49:18 +0200 Subject: [PATCH] Update Android HW encoders to the latest CodecSpecificInfoVP9 changes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Always set |first_frame_in_picture| and |end_of_superframe|. - Avoid division by zero when calculating the gof_idx. Bug: webrtc:9157 Change-Id: I19e48fa4f639815c874edec0e32deb5914912410 Tested: AppRTCMobile Reviewed-on: https://webrtc-review.googlesource.com/70143 Commit-Queue: Rasmus Brandt Reviewed-by: Sami Kalliomäki Reviewed-by: Sergey Silkin Cr-Commit-Position: refs/heads/master@{#22903} --- sdk/android/src/jni/androidmediaencoder.cc | 2 ++ sdk/android/src/jni/videoencoderwrapper.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/sdk/android/src/jni/androidmediaencoder.cc b/sdk/android/src/jni/androidmediaencoder.cc index adc6d50d39..a75d037d95 100644 --- a/sdk/android/src/jni/androidmediaencoder.cc +++ b/sdk/android/src/jni/androidmediaencoder.cc @@ -1080,6 +1080,8 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) { info.codecSpecific.VP9.gof_idx = static_cast(gof_idx_++ % gof_.num_frames_in_gof); info.codecSpecific.VP9.num_spatial_layers = 1; + info.codecSpecific.VP9.first_frame_in_picture = true; + info.codecSpecific.VP9.end_of_superframe = true; info.codecSpecific.VP9.spatial_layer_resolution_present = false; if (info.codecSpecific.VP9.ss_data_available) { info.codecSpecific.VP9.spatial_layer_resolution_present = true; diff --git a/sdk/android/src/jni/videoencoderwrapper.cc b/sdk/android/src/jni/videoencoderwrapper.cc index ae2f6ade9b..4f4086ba2f 100644 --- a/sdk/android/src/jni/videoencoderwrapper.cc +++ b/sdk/android/src/jni/videoencoderwrapper.cc @@ -66,6 +66,8 @@ int32_t VideoEncoderWrapper::InitEncodeInternal(JNIEnv* jni) { break; case kVideoCodecVP9: automatic_resize_on = codec_settings_.VP9()->automaticResizeOn; + gof_.SetGofInfoVP9(TemporalStructureMode::kTemporalStructureMode1); + gof_idx_ = 0; break; default: automatic_resize_on = true; @@ -414,6 +416,8 @@ CodecSpecificInfo VideoEncoderWrapper::ParseCodecSpecificInfo( info.codecSpecific.VP9.gof_idx = static_cast(gof_idx_++ % gof_.num_frames_in_gof); info.codecSpecific.VP9.num_spatial_layers = 1; + info.codecSpecific.VP9.first_frame_in_picture = true; + info.codecSpecific.VP9.end_of_superframe = true; info.codecSpecific.VP9.spatial_layer_resolution_present = false; if (info.codecSpecific.VP9.ss_data_available) { info.codecSpecific.VP9.spatial_layer_resolution_present = true;