summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2021-08-31 17:37:11 +0800
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-09-15 13:20:28 +0000
commit28eb729b53c8fc4d5fb67994a5f3d7ac84cbce9d (patch)
tree1bcdfb14387f56a875210c0a63845e8614f82e1d
parent5c73725c9bf2a6aee3661b7b58fb3fbd537e355b (diff)
downloadgstreamer-plugins-bad-28eb729b53c8fc4d5fb67994a5f3d7ac84cbce9d.tar.gz
codecs: h264: Add protection to to_insert picture in bump check.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2501>
-rw-r--r--gst-libs/gst/codecs/gsth264picture.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gst-libs/gst/codecs/gsth264picture.c b/gst-libs/gst/codecs/gsth264picture.c
index a687e338e..8239b1575 100644
--- a/gst-libs/gst/codecs/gsth264picture.c
+++ b/gst-libs/gst/codecs/gsth264picture.c
@@ -774,7 +774,7 @@ gst_h264_dpb_needs_bump (GstH264Dpb * dpb, GstH264Picture * to_insert,
/* Bump leading picture with the negative POC if already found positive
POC. It's even impossible to insert another negative POC after the
positive POCs. Almost safe. */
- if (lowest_poc < 0 && to_insert->pic_order_cnt > 0) {
+ if (to_insert && to_insert->pic_order_cnt > 0 && lowest_poc < 0) {
GST_TRACE ("The negative poc %d, bumping for low-latency.", lowest_poc);
return TRUE;
}
@@ -784,7 +784,7 @@ gst_h264_dpb_needs_bump (GstH264Dpb * dpb, GstH264Picture * to_insert,
following pictures. In most cases, leading pictures are in increasing
POC order. Bump and should be safe. */
if (lowest_poc == 0 && gst_h264_dpb_get_size (dpb) <= 1) {
- if (to_insert->pic_order_cnt > lowest_poc) {
+ if (to_insert && to_insert->pic_order_cnt > lowest_poc) {
GST_TRACE ("The IDR or mem_mgmt_5 frame, bumping for low-latency.");
return TRUE;
}
@@ -803,7 +803,8 @@ gst_h264_dpb_needs_bump (GstH264Dpb * dpb, GstH264Picture * to_insert,
/* When insert non-ref frame with bigger POC, it's unlike to insert
another ref frame with very small POC. Bump and should be safe. */
- if (!to_insert->ref_pic && lowest_poc < to_insert->pic_order_cnt) {
+ if (to_insert && !to_insert->ref_pic
+ && lowest_poc < to_insert->pic_order_cnt) {
GST_TRACE ("lowest-poc: %d < to insert non ref pic: %d, bumping "
"for low-latency", lowest_poc, to_insert->pic_order_cnt);
return TRUE;
@@ -843,12 +844,12 @@ normal_bump:
return FALSE;
}
- if (to_insert->ref_pic) {
+ if (to_insert && to_insert->ref_pic) {
GST_TRACE ("No empty frame buffer for ref frame, need bumping.");
return TRUE;
}
- if (to_insert->pic_order_cnt > lowest_poc) {
+ if (to_insert && to_insert->pic_order_cnt > lowest_poc) {
GST_TRACE ("No empty frame buffer, lowest poc %d < current poc %d,"
" need bumping.", lowest_poc, to_insert->pic_order_cnt);
return TRUE;