From 18e6edd57acb30e5a08c29c24d66f0d9b80d67c7 Mon Sep 17 00:00:00 2001 From: Sergey Silkin Date: Tue, 27 Oct 2020 09:08:02 +0100 Subject: [PATCH] Change SPS/PPS id update strategy to SPS_LISTING. INCREASING_ID, which is the default mode, triggers HW reset in chromium decoder wrapper. Set eSpsPpsIdStrategy to SPS_LISTING to prevent that. Note that WebRTC always resets the encoder on resolution change. This makes all strategies except INCREASING_ID essentially equivalent to CONSTANT_ID. Bug: chromium:1111273 Change-Id: I37405c97b3390f812d1dcaa111694b3b1d638035 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190440 Reviewed-by: Rasmus Brandt Commit-Queue: Sergey Silkin Cr-Commit-Position: refs/heads/master@{#32505} --- modules/video_coding/codecs/h264/h264_encoder_impl.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc index e916084819..94863942bc 100644 --- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc @@ -545,6 +545,12 @@ SEncParamExt H264EncoderImpl::CreateEncoderParams(size_t i) const { // |uiIntraPeriod| - multiple of GOP size // |keyFrameInterval| - number of frames encoder_params.uiIntraPeriod = configurations_[i].key_frame_interval; + // Reuse SPS id if possible. This helps to avoid reset of chromium HW decoder + // on each key-frame. + // Note that WebRTC resets encoder on resolution change which makes all + // EParameterSetStrategy modes except INCREASING_ID (default) essentially + // equivalent to CONSTANT_ID. + encoder_params.eSpsPpsIdStrategy = SPS_LISTING; encoder_params.uiMaxNalSize = 0; // Threading model: use auto. // 0: auto (dynamic imp. internal encoder)