mpegtsdemux: Close a buffer leak and simplify input_done
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Fri, 15 May 2020 15:05:59 +0000 (17:05 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 18 May 2020 14:11:40 +0000 (14:11 +0000)
commit9b2ed3a3fc5717362918e460d26b61052f8eef76
tree0477afd071e51f7398f14180a03d707c393ba624
parentbf004227ec9a9b86a8f77e6086bcfeae94afde96
mpegtsdemux: Close a buffer leak and simplify input_done

tsparse leaked input buffers quite badly:

    GST_TRACERS=leaks GST_DEBUG=GST_TRACER:9 gst-launch-1.0 audiotestsrc num-buffers=3 ! avenc_aac ! mpegtsmux ! tsparse ! fakesink

The input_done vfunc was passed the input buffer, which it had to
consume. For this reason, the base class takes a reference on the buffer
if and only if input_done is not NULL.

Before 34af8ed66a7c63048ce0bdf59bbe61011d7c6292, input_done was used in
tsparse to pass on the input buffer on the "src" pad. That commit
changed the code to packetize for that pad as well and removed the use
of input_done.

Afterwards, 0d2e9085236ed94622c327f73489e558cc95d05f set input_done
again in order to handle automatic alignment of the output buffers to
the input buffers. However, it ignored the provided buffer and did not
even unref it, causing a leak.

Since no code makes use of the buffer provided with input_done, just
remove the argument in order to simplify things a bit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1274>
gst/mpegtsdemux/mpegtsbase.c
gst/mpegtsdemux/mpegtsbase.h
gst/mpegtsdemux/mpegtsparse.c