d3d11h264dec: Keep track of actually configured DPB size

... instead of the largest we ever seen.
Note that d3d11h264dec element holds previously configured DPB size
for later decoder object re-open decision.

This is to fix below case:
1) Initial SPS, required DPB size is 6
  - decoder object is opened with DPB size 6
  - max_dpb_size is now 6
2) SPS update with resolution change, required DPB size is 1
  - decoder object is re-opened with DPB size 1
  - max_dpb_size should be updated to 1, but it didn't happen (BUG)
3) SPS update without resolution change, only required DPB size is updated to 6
  - decoder object should be re-opened but didn't happen
    because we didn't update max_dpb_size at 2).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2056>
This commit is contained in:
Seungha Yang 2021-03-04 17:42:28 +09:00
parent 766bd655fc
commit 3730ea3366

View file

@ -470,7 +470,6 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder,
if (self->max_dpb_size < max_dpb_size) {
GST_INFO_OBJECT (self, "Requires larger DPB size (%d -> %d)",
self->max_dpb_size, max_dpb_size);
self->max_dpb_size = max_dpb_size;
modified = TRUE;
}
@ -501,6 +500,12 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder,
gst_video_info_set_format (&info,
self->out_format, self->width, self->height);
/* Store configured DPB size here. Then, it will be referenced later
* to decide whether we need to re-open decoder object or not.
* For instance, if every configuration is same apart from DPB size and
* new DPB size is decreased, we can reuse existing decoder object.
*/
self->max_dpb_size = max_dpb_size;
gst_d3d11_decoder_reset (self->d3d11_decoder);
if (!gst_d3d11_decoder_open (self->d3d11_decoder, GST_D3D11_CODEC_H264,
&info, self->coded_width, self->coded_height,