diff options
author | Dave Robillard <dave@drobilla.net> | 2009-07-22 14:31:51 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-07-22 14:31:51 -0400 |
commit | 5d9d4a7b518c42bda88c7f6c87ce7c3c01233562 (patch) | |
tree | d9b88c996e614a41b97d22bacb8d6d47830a0944 | |
parent | ef6dbf9be87af7a91a50a910f8578ce3de75846c (diff) | |
parent | 2abe07f963b6eb9c689e26b352cb394434cc5a56 (diff) | |
download | gst-plugins-bad-5d9d4a7b518c42bda88c7f6c87ce7c3c01233562.tar.gz gst-plugins-bad-5d9d4a7b518c42bda88c7f6c87ce7c3c01233562.tar.bz2 gst-plugins-bad-5d9d4a7b518c42bda88c7f6c87ce7c3c01233562.zip |
Merge branch 'master' of git://anongit.freedesktop.org/gstreamer/gst-plugins-bad into fdo
-rw-r--r-- | ext/mimic/gstmimenc.c | 16 | ||||
-rw-r--r-- | gst/rtpmanager/rtpsession.c | 3 | ||||
-rw-r--r-- | gst/rtpmux/gstrtpmux.c | 68 |
3 files changed, 57 insertions, 30 deletions
diff --git a/ext/mimic/gstmimenc.c b/ext/mimic/gstmimenc.c index fce5a47d..2418e7c8 100644 --- a/ext/mimic/gstmimenc.c +++ b/ext/mimic/gstmimenc.c @@ -346,13 +346,8 @@ gst_mimenc_chain (GstPad * pad, GstBuffer * in) GST_OBJECT_UNLOCK (mimenc); if (event) { - if (!gst_pad_push_event (mimenc->srcpad, event)) { - res = GST_FLOW_ERROR; - GST_ERROR_OBJECT (mimenc, "Failed to push NEWSEGMENT event"); - gst_buffer_unref (header); - gst_buffer_unref (out_buf); - goto out; - } + if (!gst_pad_push_event (mimenc->srcpad, event)) + GST_WARNING_OBJECT (mimenc, "Failed to push NEWSEGMENT event"); } res = gst_pad_push (mimenc->srcpad, header); @@ -513,11 +508,8 @@ paused_mode_task (gpointer data) " sending out a pause frame"); if (event) { - if (!gst_pad_push_event (mimenc->srcpad, event)) { - GST_ERROR_OBJECT (mimenc, "Failed to push NEWSEGMENT event"); - gst_buffer_unref (buffer); - goto stop_task; - } + if (!gst_pad_push_event (mimenc->srcpad, event)) + GST_WARNING_OBJECT (mimenc, "Failed to push NEWSEGMENT event"); } ret = gst_pad_push (mimenc->srcpad, buffer); if (ret < 0) { diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index fa46f501..d63d9d0e 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -369,6 +369,9 @@ rtp_session_finalize (GObject * object) for (i = 0; i < 32; i++) g_hash_table_destroy (sess->ssrcs[i]); + g_list_foreach (sess->conflicting_addresses, (GFunc) g_free, NULL); + g_list_free (sess->conflicting_addresses); + g_free (sess->bye_reason); g_hash_table_destroy (sess->cnames); diff --git a/gst/rtpmux/gstrtpmux.c b/gst/rtpmux/gstrtpmux.c index 82d4b003..4c2bea09 100644 --- a/gst/rtpmux/gstrtpmux.c +++ b/gst/rtpmux/gstrtpmux.c @@ -87,6 +87,7 @@ static void gst_rtp_mux_finalize (GObject * object); static GstPad *gst_rtp_mux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name); +static void gst_rtp_mux_release_pad (GstElement * element, GstPad * pad); static GstFlowReturn gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer); static gboolean gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps); static GstCaps *gst_rtp_mux_getcaps (GstPad * pad); @@ -148,6 +149,7 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass) gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_rtp_mux_request_new_pad); + gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_mux_release_pad); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_mux_change_state); klass->chain_func = gst_rtp_mux_chain; @@ -246,15 +248,6 @@ gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ) } static void -free_pad_private (gpointer data, GObject * where_the_object_was) -{ - GstRTPMuxPadPrivate *padpriv = data; - - gst_caps_replace (&padpriv->out_caps, NULL); - g_slice_free (GstRTPMuxPadPrivate, padpriv); -} - -static void gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad) { GstRTPMuxClass *klass; @@ -274,7 +267,6 @@ gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad) gst_pad_set_active (sinkpad, TRUE); gst_pad_set_element_private (sinkpad, padpriv); - g_object_weak_ref (G_OBJECT (sinkpad), free_pad_private, padpriv); /* dd the pad to the element */ gst_element_add_pad (GST_ELEMENT (rtp_mux), sinkpad); @@ -306,6 +298,24 @@ gst_rtp_mux_request_new_pad (GstElement * element, return newpad; } +static void +gst_rtp_mux_release_pad (GstElement * element, GstPad * pad) +{ + GstRTPMuxPadPrivate *padpriv; + + GST_OBJECT_LOCK (element); + padpriv = gst_pad_get_element_private (pad); + gst_pad_set_element_private (pad, NULL); + GST_OBJECT_UNLOCK (element); + + gst_element_remove_pad (element, pad); + + if (padpriv) { + gst_caps_replace (&padpriv->out_caps, NULL); + g_slice_free (GstRTPMuxPadPrivate, padpriv); + } +} + /* Put our own clock-base on the buffer */ static void gst_rtp_mux_readjust_rtp_timestamp (GstRTPMux * rtp_mux, GstPad * pad, @@ -313,10 +323,14 @@ gst_rtp_mux_readjust_rtp_timestamp (GstRTPMux * rtp_mux, GstPad * pad, { guint32 ts; guint32 sink_ts_base = 0; - GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad); + GstRTPMuxPadPrivate *padpriv; + - if (padpriv->have_clock_base) + GST_OBJECT_LOCK (rtp_mux); + padpriv = gst_pad_get_element_private (pad); + if (padpriv && padpriv->have_clock_base) sink_ts_base = padpriv->clock_base; + GST_OBJECT_UNLOCK (rtp_mux); ts = gst_rtp_buffer_get_timestamp (buffer) - sink_ts_base + rtp_mux->ts_base; GST_LOG_OBJECT (rtp_mux, "Re-adjusting RTP ts %u to %u", @@ -329,7 +343,7 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer) { GstRTPMux *rtp_mux; GstFlowReturn ret; - GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad); + GstRTPMuxPadPrivate *padpriv; rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad)); @@ -344,6 +358,9 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer) GST_OBJECT_LOCK (rtp_mux); rtp_mux->seqnum++; gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum); + padpriv = gst_pad_get_element_private (pad); + if (padpriv) + gst_buffer_set_caps (buffer, padpriv->out_caps); GST_OBJECT_UNLOCK (rtp_mux); gst_rtp_buffer_set_ssrc (buffer, rtp_mux->current_ssrc); gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, pad, buffer); @@ -351,10 +368,16 @@ gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer) GST_BUFFER_SIZE (buffer), rtp_mux->seqnum, gst_rtp_buffer_get_timestamp (buffer)); - gst_buffer_set_caps (buffer, padpriv->out_caps); + if (!padpriv) { + ret = GST_FLOW_NOT_LINKED; + gst_buffer_unref (buffer); + goto out; + } ret = gst_pad_push (rtp_mux->srcpad, buffer); +out: + gst_object_unref (rtp_mux); return ret; } @@ -365,7 +388,7 @@ gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps) GstRTPMux *rtp_mux; GstStructure *structure; gboolean ret = FALSE; - GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad); + GstRTPMuxPadPrivate *padpriv; rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad)); @@ -374,9 +397,13 @@ gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps) if (!structure) goto out; - if (gst_structure_get_uint (structure, "clock-base", &padpriv->clock_base)) { + GST_OBJECT_LOCK (rtp_mux); + padpriv = gst_pad_get_element_private (pad); + if (padpriv && + gst_structure_get_uint (structure, "clock-base", &padpriv->clock_base)) { padpriv->have_clock_base = TRUE; } + GST_OBJECT_UNLOCK (rtp_mux); caps = gst_caps_copy (caps); @@ -388,8 +415,13 @@ gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps) "setting caps %" GST_PTR_FORMAT " on src pad..", caps); ret = gst_pad_set_caps (rtp_mux->srcpad, caps); - if (ret) - gst_caps_replace (&padpriv->out_caps, caps); + if (ret) { + GST_OBJECT_LOCK (rtp_mux); + padpriv = gst_pad_get_element_private (pad); + if (padpriv) + gst_caps_replace (&padpriv->out_caps, caps); + GST_OBJECT_UNLOCK (rtp_mux); + } gst_caps_unref (caps); out: |