sys: va: GstVaMpeg2Dec: use slice sc_offset and size
authorDaniel Almeida <daniel.almeida@collabora.com>
Fri, 26 Mar 2021 18:52:21 +0000 (15:52 -0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 2 Nov 2021 16:16:29 +0000 (16:16 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1013>

subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c

index b064cc7..9c2f574 100644 (file)
@@ -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;