codecs: Integrate H265 DPB full check into need_bump().
authorHe Junyan <junyan.he@intel.com>
Mon, 31 May 2021 09:51:58 +0000 (17:51 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 2 Jun 2021 13:10:35 +0000 (13:10 +0000)
commitc442c9bd5e16b40cc386577ddffa6e404cd9bebe
tree2b144bbc90467716e2980d57567f30feb4018e1d
parentcbe89db444b8c641f92383d4cf3ad1ec2969c025
codecs: Integrate H265 DPB full check into need_bump().

The current DPB check of H265 is not very correct. The current frame
is already in the DPB when we check whether the DPB is full.
For example, the DPB max size is 16 and we have 15 ref frames in the
DPB, so the gst_h265_dpb_delete_unused() cleans no one, and then plus
the current frame, the DPB is 16. This causes an error return, but in
fact, the stream is correct.
We now integrate the DPB full check into the need_bump() function.
We add the correct frame into to DPB and then check whether the picture
num is bigger than max_num_pics of DPB(which means there is no room for
the current picture). If true, we bump the DPB immediately.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2291>
gst-libs/gst/codecs/gsth265decoder.c
gst-libs/gst/codecs/gsth265picture.c
gst-libs/gst/codecs/gsth265picture.h