From f6e17ea2944f15e952183042ad34edfeb08229fe Mon Sep 17 00:00:00 2001 From: Daniel Almeida Date: Fri, 26 Mar 2021 15:52:21 -0300 Subject: [PATCH] sys: va: GstVaMpeg2Dec: use slice sc_offset and size Seeing as how GstMpeg2Slice will now record the start code offset as well as its size with the above field taken into account, the manual computation in this class is not needed. Remove it. Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c b/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c index b064cc7290..9c2f574b93 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c @@ -520,15 +520,9 @@ gst_va_mpeg2_dec_decode_slice (GstMpeg2Decoder * decoder, GstVaDecodePicture *va_pic; VASliceParameterBufferMPEG2 slice_param; - /* The slice data pass to driver should be a full packet - include the start code. The packet->offset return by - gst_mpeg_video_parse does not include the start code - and so we need to wrap back 4 bytes. */ - g_assert (packet->offset >= 4); - /* *INDENT-OFF* */ slice_param = (VASliceParameterBufferMPEG2) { - .slice_data_size = packet->size + 4 /* start code */, + .slice_data_size = slice->size, .slice_data_offset = 0, .slice_data_flag = VA_SLICE_DATA_FLAG_ALL, .macroblock_offset = header->header_size + 32, @@ -542,8 +536,7 @@ gst_va_mpeg2_dec_decode_slice (GstMpeg2Decoder * decoder, va_pic = gst_mpeg2_picture_get_user_data (picture); if (!gst_va_decoder_add_slice_buffer (base->decoder, va_pic, &slice_param, sizeof (slice_param), - (guint8 *) (packet->data + packet->offset - 4 /* start code */ ), - packet->size + 4 /* start code */ )) + (guint8 *) (packet->data + slice->sc_offset), slice->size)) return GST_FLOW_ERROR; return GST_FLOW_OK;