diff options
author | He Junyan <junyan.he@intel.com> | 2021-07-22 22:00:38 +0800 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-07-23 07:17:06 +0000 |
commit | 99636cd101be97f1fffd62abafc142d2b2b068b2 (patch) | |
tree | 0857140616f8d6b149cc33236a9d84e083b9e0a1 /sys | |
parent | a79a756b79aa1675e4ae14eced8b08cdd578d50a (diff) | |
download | gstreamer-plugins-bad-99636cd101be97f1fffd62abafc142d2b2b068b2.tar.gz |
va: h265dec: Do not assign the frame->output_buffer until output_picture.
We may need to drop the slices such as RASL pictures with the NoRaslOutputFlag, so
the current picture of h265decoder may be freed. We should not assign the frame->
output_buffer too early until we really output it. Or, the later coming slices will
allocate another picture and trigger the assert of:
gst_video_decoder_allocate_output_frame_with_params:
assertion 'frame->output_buffer == NULL' failed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2421>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/va/gstvah265dec.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/va/gstvah265dec.c b/sys/va/gstvah265dec.c index d3f357a6d..5c72d44bf 100644 --- a/sys/va/gstvah265dec.c +++ b/sys/va/gstvah265dec.c @@ -227,6 +227,10 @@ gst_va_h265_dec_output_picture (GstH265Decoder * decoder, { GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVaH265Dec *self = GST_VA_H265_DEC (decoder); + GstVaDecodePicture *va_pic; + + va_pic = gst_h265_picture_get_user_data (picture); + g_assert (va_pic->gstbuffer); GST_LOG_OBJECT (self, "Outputting picture %p (poc %d)", picture, picture->pic_order_cnt); @@ -238,6 +242,8 @@ gst_va_h265_dec_output_picture (GstH265Decoder * decoder, return self->last_ret; } + gst_buffer_replace (&frame->output_buffer, va_pic->gstbuffer); + if (base->copy_frames) gst_va_base_dec_copy_output_buffer (base, frame); @@ -842,13 +848,18 @@ gst_va_h265_dec_new_picture (GstH265Decoder * decoder, GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVaH265Dec *self = GST_VA_H265_DEC (decoder); GstVaDecodePicture *pic; + GstBuffer *output_buffer; GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder); - self->last_ret = gst_video_decoder_allocate_output_frame (vdec, frame); - if (self->last_ret != GST_FLOW_OK) + output_buffer = gst_video_decoder_allocate_output_buffer (vdec); + if (!output_buffer) { + self->last_ret = GST_FLOW_ERROR; goto error; + } + self->last_ret = GST_FLOW_OK; - pic = gst_va_decode_picture_new (base->decoder, frame->output_buffer); + pic = gst_va_decode_picture_new (base->decoder, output_buffer); + gst_buffer_unref (output_buffer); gst_h265_picture_set_user_data (picture, pic, (GDestroyNotify) gst_va_decode_picture_free); |