diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-03-13 13:59:25 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-03-14 12:45:33 +0200 |
commit | 65390b5129ce44b0785ec765dbf659249ab59cca (patch) | |
tree | 652bb68f5378d83caeab83e4a26f5a4260752a39 | |
parent | 1d4fb48718a2f8e5610c1fe2761640dd0435a9c4 (diff) | |
download | gstreamer-plugins-base-65390b5129ce44b0785ec765dbf659249ab59cca.tar.gz |
multihandlesink: Remove useless streamheader storage
We don't do anything with it but always get them from the caps anyway, so
stop storing them and having complicated logic around that.
https://bugzilla.gnome.org/show_bug.cgi?id=763278
-rw-r--r-- | gst/tcp/gstmultihandlesink.c | 34 | ||||
-rw-r--r-- | gst/tcp/gstmultihandlesink.h | 3 | ||||
-rw-r--r-- | tests/check/elements/multifdsink.c | 6 | ||||
-rw-r--r-- | tests/check/elements/multisocketsink.c | 6 |
4 files changed, 11 insertions, 38 deletions
diff --git a/gst/tcp/gstmultihandlesink.c b/gst/tcp/gstmultihandlesink.c index 651d0ac08..8a99e001e 100644 --- a/gst/tcp/gstmultihandlesink.c +++ b/gst/tcp/gstmultihandlesink.c @@ -1959,32 +1959,15 @@ gst_multi_handle_sink_render (GstBaseSink * bsink, GstBuffer * buf) GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); - /* if we get IN_CAPS buffers, but the previous buffer was not IN_CAPS, - * it means we're getting new streamheader buffers, and we should clear - * the old ones */ - if (is_header && !sink->previous_buffer_is_header) { - GST_DEBUG_OBJECT (sink, - "receiving new HEADER buffers, clearing old streamheader"); - g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL); - g_slist_free (sink->streamheader); - sink->streamheader = NULL; - } - - /* save the current in_caps */ - sink->previous_buffer_is_header = is_header; - - /* if the incoming buffer is marked as IN CAPS, then we assume for now - * it's a streamheader that needs to be sent to each new client, so we - * put it on our internal list of streamheader buffers. - * FIXME: we could check if the buffer's contents are in fact part of the - * current streamheader. + /* if the incoming buffer is a streamheader from the caps, then we assume for now + * it's a streamheader that needs to be sent to each new client. * * We don't send the buffer to the client, since streamheaders are sent * separately when necessary. */ if (in_caps) { - GST_DEBUG_OBJECT (sink, "appending HEADER buffer with length %" - G_GSIZE_FORMAT " to streamheader", gst_buffer_get_size (buf)); - sink->streamheader = g_slist_append (sink->streamheader, buf); + GST_DEBUG_OBJECT (sink, "ignoring HEADER buffer with length %" + G_GSIZE_FORMAT, gst_buffer_get_size (buf)); + gst_buffer_unref (buf); } else { /* queue the buffer, this is a regular data buffer. */ gst_multi_handle_sink_queue_buffer (sink, buf); @@ -2162,7 +2145,6 @@ gst_multi_handle_sink_start (GstBaseSink * bsink) if (!mhsclass->start_pre (mhsink)) return FALSE; - mhsink->streamheader = NULL; mhsink->bytes_to_serve = 0; mhsink->bytes_served = 0; @@ -2207,12 +2189,6 @@ gst_multi_handle_sink_stop (GstBaseSink * bsink) /* free the clients */ mhclass->clear (GST_MULTI_HANDLE_SINK (mhsink)); - if (mhsink->streamheader) { - g_slist_foreach (mhsink->streamheader, (GFunc) gst_mini_object_unref, NULL); - g_slist_free (mhsink->streamheader); - mhsink->streamheader = NULL; - } - if (mhclass->close) mhclass->close (mhsink); diff --git a/gst/tcp/gstmultihandlesink.h b/gst/tcp/gstmultihandlesink.h index e64d44a4c..564796578 100644 --- a/gst/tcp/gstmultihandlesink.h +++ b/gst/tcp/gstmultihandlesink.h @@ -202,9 +202,6 @@ struct _GstMultiHandleSink { GMainContext *main_context; GCancellable *cancellable; - GSList *streamheader; /* GSList of GstBuffers to use as streamheader */ - gboolean previous_buffer_is_header; - gint qos_dscp; GArray *bufqueue; /* global queue of buffers */ diff --git a/tests/check/elements/multifdsink.c b/tests/check/elements/multifdsink.c index 431616ddf..2bc4a7968 100644 --- a/tests/check/elements/multifdsink.c +++ b/tests/check/elements/multifdsink.c @@ -400,9 +400,9 @@ GST_START_TEST (test_change_streamheader) /* change the streamheader */ - /* before we change, multifdsink still has a list of the old streamheaders */ - ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2); - ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2); + /* only we have a reference to the streamheaders now */ + ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 1); + ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 1); gst_buffer_unref (hbuf1); gst_buffer_unref (hbuf2); diff --git a/tests/check/elements/multisocketsink.c b/tests/check/elements/multisocketsink.c index d3a9a6517..de036c2a9 100644 --- a/tests/check/elements/multisocketsink.c +++ b/tests/check/elements/multisocketsink.c @@ -542,9 +542,9 @@ GST_START_TEST (test_change_streamheader) /* change the streamheader */ - /* before we change, multisocketsink still has a list of the old streamheaders */ - ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2); - ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2); + /* only we have a reference to the streamheaders now */ + ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 1); + ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 1); gst_buffer_unref (hbuf1); gst_buffer_unref (hbuf2); |