v4l2slh264dec: Renew bitstream buffer after submitting slice

Submitting a slice actually clears the bitstream buffer. Ensure we
have a newly allocated bitstream buffer for the next slice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
This commit is contained in:
Nicolas Dufresne 2020-06-29 13:25:39 -04:00
parent bc1a0323a9
commit b20c6fe6c4

View file

@ -1041,20 +1041,25 @@ gst_v4l2_codec_h264_dec_decode_slice (GstH264Decoder * decoder,
GstV4l2CodecH264Dec *self = GST_V4L2_CODEC_H264_DEC (decoder); GstV4l2CodecH264Dec *self = GST_V4L2_CODEC_H264_DEC (decoder);
gsize sc_off = 0; gsize sc_off = 0;
gsize nal_size; gsize nal_size;
guint8 *bitstream_data = self->bitstream_map.data + self->bitstream_map.size; guint8 *bitstream_data;
if (is_slice_based (self)) { if (is_slice_based (self)) {
/* In slice mode, we submit the pending slice asking the acceletator to hold if (self->bitstream_map.size) {
* on the picture */ /* In slice mode, we submit the pending slice asking the accelerator to
if (self->bitstream_map.size) * hold on the picture */
gst_v4l2_codec_h264_dec_submit_bitstream (self, picture, if (!gst_v4l2_codec_h264_dec_submit_bitstream (self, picture,
V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF); V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF)
|| !gst_v4l2_codec_h264_dec_ensure_bitstream (self))
return FALSE;
}
gst_v4l2_codec_h264_dec_fill_slice_params (self, slice); gst_v4l2_codec_h264_dec_fill_slice_params (self, slice);
gst_v4l2_codec_h264_dec_fill_references (self, ref_pic_list0, gst_v4l2_codec_h264_dec_fill_references (self, ref_pic_list0,
ref_pic_list1); ref_pic_list1);
} }
bitstream_data = self->bitstream_map.data + self->bitstream_map.size;
if (needs_start_codes (self)) if (needs_start_codes (self))
sc_off = 3; sc_off = 3;
nal_size = sc_off + slice->nalu.size; nal_size = sc_off + slice->nalu.size;