diff options
author | Jan Schmidt <jan@centricular.com> | 2018-01-26 22:44:24 +1100 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2018-02-09 18:07:59 +1100 |
commit | 577c14495c3ff4c3905e50fe9a8aca3fa42e5177 (patch) | |
tree | 44ca6e36e91b79a19732810662a46323825d56c1 | |
parent | fbef9220d3dc2f785081c4766901aab2ecfaed10 (diff) |
tcp/multihandlesink: Handle the case of no caps
Pass data with no caps and no streamheaders without
throwing a bunch of criticals
-rw-r--r-- | gst/tcp/gstmultihandlesink.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gst/tcp/gstmultihandlesink.c b/gst/tcp/gstmultihandlesink.c index c8268e235..38af70a7d 100644 --- a/gst/tcp/gstmultihandlesink.c +++ b/gst/tcp/gstmultihandlesink.c @@ -1038,11 +1038,13 @@ gst_multi_handle_sink_client_queue_buffer (GstMultiHandleSink * mhsink, caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (sink)); if (!mhclient->caps) { - GST_DEBUG_OBJECT (sink, - "%s no previous caps for this client, send streamheader", - mhclient->debug); - send_streamheader = TRUE; - mhclient->caps = gst_caps_ref (caps); + if (caps) { + GST_DEBUG_OBJECT (sink, + "%s no previous caps for this client, send streamheader", + mhclient->debug); + send_streamheader = TRUE; + mhclient->caps = gst_caps_ref (caps); + } } else { /* there were previous caps recorded, so compare */ if (!gst_caps_is_equal (caps, mhclient->caps)) { @@ -1086,8 +1088,7 @@ gst_multi_handle_sink_client_queue_buffer (GstMultiHandleSink * mhsink, } } /* Replace the old caps */ - gst_caps_unref (mhclient->caps); - mhclient->caps = gst_caps_ref (caps); + gst_caps_replace (&mhclient->caps, caps); } if (G_UNLIKELY (send_streamheader)) { @@ -1127,7 +1128,8 @@ gst_multi_handle_sink_client_queue_buffer (GstMultiHandleSink * mhsink, } } - gst_caps_unref (caps); + if (caps) + gst_caps_unref (caps); caps = NULL; GST_LOG_OBJECT (sink, "%s queueing buffer of length %" G_GSIZE_FORMAT, |