summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-10-09 15:40:49 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:49:15 +0100
commit431e3513eca7ac401c23b4bfdd81d678f1861473 (patch)
tree2ca07e6eb6d97cd18dc75c0f508607602f87e1d2 /gst-libs/gst
parent0ede05c7a961c1295ef782f71712ac694f7e733e (diff)
mpeg2: fix memory leak of empty packets.
Fix memory leakage of empty packets, i.e. packets that only contain the start code prefix. In particular, free empty user-data packets. Besides, the codec parser will already fail gracefully if the packet to parse does not have the minimum required size. So, we can also completely drop the block of code that used to handle packets of size 4 (including the start code).
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
index 2b8851f4..92ff0328 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
@@ -971,7 +971,7 @@ decode_buffer(GstVaapiDecoderMpeg2 *decoder, GstBuffer *buffer)
}
status = GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
- if (size < 8)
+ if (size < 4)
break;
ofs = scan_for_start_code(priv->adapter, 0, size, &start_code);
if (ofs < 0)
@@ -992,17 +992,6 @@ decode_buffer(GstVaapiDecoderMpeg2 *decoder, GstBuffer *buffer)
buffer = gst_adapter_take_buffer(priv->adapter, ofs);
size -= ofs;
- if (ofs == 4) {
- // Ignore empty user-data packets
- if ((start_code & 0xff) == GST_MPEG_VIDEO_PACKET_USER_DATA) {
- status = GST_VAAPI_DECODER_STATUS_SUCCESS;
- continue;
- }
- GST_ERROR("failed to get a valid packet (SC: 0x%08x)", start_code);
- status = GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER;
- break;
- }
-
buf = GST_BUFFER_DATA(buffer);
buf_size = GST_BUFFER_SIZE(buffer);