summaryrefslogtreecommitdiff
path: root/gst/mpegtsdemux/mpegtsbase.c
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>2020-05-15 17:05:59 +0200
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-05-18 14:11:40 +0000
commit9b2ed3a3fc5717362918e460d26b61052f8eef76 (patch)
tree0477afd071e51f7398f14180a03d707c393ba624 /gst/mpegtsdemux/mpegtsbase.c
parentbf004227ec9a9b86a8f77e6086bcfeae94afde96 (diff)
downloadgstreamer-plugins-bad-9b2ed3a3fc5717362918e460d26b61052f8eef76.tar.gz
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>
Diffstat (limited to 'gst/mpegtsdemux/mpegtsbase.c')
-rw-r--r--gst/mpegtsdemux/mpegtsbase.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index 3ca041c7e..237a8938b 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -1431,9 +1431,6 @@ mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
packetizer = base->packetizer;
- if (klass->input_done)
- gst_buffer_ref (buf);
-
if (GST_BUFFER_IS_DISCONT (buf)) {
GST_DEBUG_OBJECT (base, "Got DISCONT buffer, flushing");
res = mpegts_base_drain (base);
@@ -1501,12 +1498,8 @@ mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
mpegts_packetizer_clear_packet (base->packetizer, &packet);
}
- if (klass->input_done) {
- if (res == GST_FLOW_OK)
- res = klass->input_done (base, buf);
- else
- gst_buffer_unref (buf);
- }
+ if (res == GST_FLOW_OK && klass->input_done)
+ res = klass->input_done (base);
return res;
}