Commit 65390b51 authored by Sebastian Dröge's avatar Sebastian Dröge

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
parent 1d4fb487
...@@ -1959,32 +1959,15 @@ gst_multi_handle_sink_render (GstBaseSink * bsink, GstBuffer * buf) ...@@ -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_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
/* if we get IN_CAPS buffers, but the previous buffer was not IN_CAPS, /* if the incoming buffer is a streamheader from the caps, then we assume for now
* it means we're getting new streamheader buffers, and we should clear * it's a streamheader that needs to be sent to each new client.
* 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.
* *
* We don't send the buffer to the client, since streamheaders are sent * We don't send the buffer to the client, since streamheaders are sent
* separately when necessary. */ * separately when necessary. */
if (in_caps) { if (in_caps) {
GST_DEBUG_OBJECT (sink, "appending HEADER buffer with length %" GST_DEBUG_OBJECT (sink, "ignoring HEADER buffer with length %"
G_GSIZE_FORMAT " to streamheader", gst_buffer_get_size (buf)); G_GSIZE_FORMAT, gst_buffer_get_size (buf));
sink->streamheader = g_slist_append (sink->streamheader, buf); gst_buffer_unref (buf);
} else { } else {
/* queue the buffer, this is a regular data buffer. */ /* queue the buffer, this is a regular data buffer. */
gst_multi_handle_sink_queue_buffer (sink, buf); gst_multi_handle_sink_queue_buffer (sink, buf);
...@@ -2162,7 +2145,6 @@ gst_multi_handle_sink_start (GstBaseSink * bsink) ...@@ -2162,7 +2145,6 @@ gst_multi_handle_sink_start (GstBaseSink * bsink)
if (!mhsclass->start_pre (mhsink)) if (!mhsclass->start_pre (mhsink))
return FALSE; return FALSE;
mhsink->streamheader = NULL;
mhsink->bytes_to_serve = 0; mhsink->bytes_to_serve = 0;
mhsink->bytes_served = 0; mhsink->bytes_served = 0;
...@@ -2207,12 +2189,6 @@ gst_multi_handle_sink_stop (GstBaseSink * bsink) ...@@ -2207,12 +2189,6 @@ gst_multi_handle_sink_stop (GstBaseSink * bsink)
/* free the clients */ /* free the clients */
mhclass->clear (GST_MULTI_HANDLE_SINK (mhsink)); 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) if (mhclass->close)
mhclass->close (mhsink); mhclass->close (mhsink);
......
...@@ -202,9 +202,6 @@ struct _GstMultiHandleSink { ...@@ -202,9 +202,6 @@ struct _GstMultiHandleSink {
GMainContext *main_context; GMainContext *main_context;
GCancellable *cancellable; GCancellable *cancellable;
GSList *streamheader; /* GSList of GstBuffers to use as streamheader */
gboolean previous_buffer_is_header;
gint qos_dscp; gint qos_dscp;
GArray *bufqueue; /* global queue of buffers */ GArray *bufqueue; /* global queue of buffers */
......
...@@ -400,9 +400,9 @@ GST_START_TEST (test_change_streamheader) ...@@ -400,9 +400,9 @@ GST_START_TEST (test_change_streamheader)
/* change the streamheader */ /* change the streamheader */
/* before we change, multifdsink still has a list of the old streamheaders */ /* only we have a reference to the streamheaders now */
ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2); ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 1);
ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2); ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 1);
gst_buffer_unref (hbuf1); gst_buffer_unref (hbuf1);
gst_buffer_unref (hbuf2); gst_buffer_unref (hbuf2);
......
...@@ -542,9 +542,9 @@ GST_START_TEST (test_change_streamheader) ...@@ -542,9 +542,9 @@ GST_START_TEST (test_change_streamheader)
/* change the streamheader */ /* change the streamheader */
/* before we change, multisocketsink still has a list of the old streamheaders */ /* only we have a reference to the streamheaders now */
ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2); ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 1);
ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2); ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 1);
gst_buffer_unref (hbuf1); gst_buffer_unref (hbuf1);
gst_buffer_unref (hbuf2); gst_buffer_unref (hbuf2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment