From e8492fee6b82a1d0076f19c212400f42f2cb6fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMichael?= Date: Fri, 4 May 2018 08:37:40 -0500 Subject: [PATCH] Mitigate RTP pic ID errors in VP9 SVC non-flexible mode The code changes in this CL configure VP9 SVC to drop a superframe when the spatial base layer is dropped and to not drop upper spatial layers when the spatial base layer is not dropped. The changes are effective in non-flexible mode when codec_.mode == kRealtimeVideo and number of spatial layers > 1. Bug: none Change-Id: I27481b78f733cfc6c007d1ad9f45d69263853149 Reviewed-on: https://webrtc-review.googlesource.com/74261 Commit-Queue: Michael Horowitz Reviewed-by: Sergey Silkin Reviewed-by: Rasmus Brandt Cr-Commit-Position: refs/heads/master@{#23127} --- modules/video_coding/codecs/vp9/vp9_impl.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc index 9d1752e11d..e036d5391b 100644 --- a/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -602,6 +602,19 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image, layer_id.spatial_layer_id = settings.start_layer; vpx_codec_control(encoder_, VP9E_SET_SVC_LAYER_ID, &layer_id); vpx_codec_control(encoder_, VP9E_SET_SVC_REF_FRAME_CONFIG, &enc_layer_conf); + } else if (codec_.mode == kRealtimeVideo && num_spatial_layers_ > 1) { + // In RTP non-flexible mode, frame dropping of individual layers in a + // superframe leads to incorrect reference picture ID values in the + // RTP header. Dropping the entire superframe if the base is dropped + // or not dropping upper layers if base is not dropped mitigates + // the problem. + vpx_svc_frame_drop_t svc_drop_frame; + svc_drop_frame.framedrop_mode = CONSTRAINED_LAYER_DROP; + for (size_t i = 0; i < num_spatial_layers_; ++i) { + svc_drop_frame.framedrop_thresh[i] = + (i == 0) ? config_->rc_dropframe_thresh : 0; + } + vpx_codec_control(encoder_, VP9E_SET_SVC_FRAME_DROP_LAYER, &svc_drop_frame); } RTC_CHECK_GT(codec_.maxFramerate, 0);