diff options
author | He Junyan <junyan.he@intel.com> | 2021-07-05 23:53:25 +0800 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-07-21 15:23:17 +0000 |
commit | 23b15aa5d066d73a0691d982e764309fe8c0802a (patch) | |
tree | fe03eca40826d67e95ff2f50d2dc8bbff54d8aa8 /gst-libs | |
parent | 7a6bc987a54dc3ddec6cbb0eac6c10cc9e8472ee (diff) | |
download | gstreamer-plugins-bad-23b15aa5d066d73a0691d982e764309fe8c0802a.tar.gz |
codecs: h264dec: Set picture to a small poc when mem_mgmt_5.
When current frame memory_management_control_operation equal to 5, that
means we need to drain the dpb and the current picture act as an IDR frame.
So it should have smaller poc than the later pictures to ensure the output
order.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/codecs/gsth264picture.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gst-libs/gst/codecs/gsth264picture.c b/gst-libs/gst/codecs/gsth264picture.c index 90fa1c346..b5a1de5f1 100644 --- a/gst-libs/gst/codecs/gsth264picture.c +++ b/gst-libs/gst/codecs/gsth264picture.c @@ -991,6 +991,22 @@ gst_h264_dpb_perform_memory_management_control_operation (GstH264Dpb * dpb, } picture->mem_mgmt_5 = TRUE; picture->frame_num = 0; + /* When the current picture includes a memory management control operation + equal to 5, after the decoding of the current picture, tempPicOrderCnt + is set equal to PicOrderCnt( CurrPic ), TopFieldOrderCnt of the current + picture (if any) is set equal to TopFieldOrderCnt - tempPicOrderCnt, + and BottomFieldOrderCnt of the current picture (if any) is set equal to + BottomFieldOrderCnt - tempPicOrderCnt. */ + if (picture->field == GST_H264_PICTURE_FIELD_TOP_FIELD) { + picture->top_field_order_cnt = picture->pic_order_cnt = 0; + } else if (picture->field == GST_H264_PICTURE_FIELD_BOTTOM_FIELD) { + picture->bottom_field_order_cnt = picture->pic_order_cnt = 0; + } else { + picture->top_field_order_cnt -= picture->pic_order_cnt; + picture->bottom_field_order_cnt -= picture->pic_order_cnt; + picture->pic_order_cnt = MIN (picture->top_field_order_cnt, + picture->bottom_field_order_cnt); + } break; case 6: /* 8.2.5.4.6 Replace long term reference pictures with current picture. |