From 15dfdc58d430cfa8ebf8c536e26580d51ec687be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 10 Sep 2012 20:38:14 -0400 Subject: [PATCH] rtpmux: Misc fix for 0.11 Convert the incoming caps before proxying them Clear the last_pad when going to ready tests: Implement accept_caps, don't leak event --- gst/rtpmanager/gstrtpmux.c | 26 ++++++++++++++++++++------ tests/check/elements/rtpmux.c | 10 ++++++++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/gst/rtpmanager/gstrtpmux.c b/gst/rtpmanager/gstrtpmux.c index 7f69957d2c..c68fe522e1 100644 --- a/gst/rtpmanager/gstrtpmux.c +++ b/gst/rtpmanager/gstrtpmux.c @@ -452,7 +452,14 @@ resend_events (GstPad * pad, GstEvent ** event, gpointer user_data) { GstRTPMux *rtp_mux = user_data; - gst_pad_push_event (rtp_mux->srcpad, gst_event_ref (*event)); + if (GST_EVENT_TYPE (*event) == GST_EVENT_CAPS) { + GstCaps *caps; + + gst_event_parse_caps (*event, &caps); + gst_rtp_mux_setcaps (pad, rtp_mux, caps); + } else { + gst_pad_push_event (rtp_mux->srcpad, gst_event_ref (*event)); + } return TRUE; } @@ -836,23 +843,30 @@ static GstStateChangeReturn gst_rtp_mux_change_state (GstElement * element, GstStateChange transition) { GstRTPMux *rtp_mux; + GstStateChangeReturn ret; rtp_mux = GST_RTP_MUX (element); switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - break; case GST_STATE_CHANGE_READY_TO_PAUSED: gst_rtp_mux_ready_to_paused (rtp_mux); break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - break; default: break; } - return GST_ELEMENT_CLASS (gst_rtp_mux_parent_class)->change_state (element, + ret = GST_ELEMENT_CLASS (gst_rtp_mux_parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: + g_clear_object (&rtp_mux->last_pad); + break; + default: + break; + } + + return ret; } gboolean diff --git a/tests/check/elements/rtpmux.c b/tests/check/elements/rtpmux.c index 1228e5b8fd..b565b1f199 100644 --- a/tests/check/elements/rtpmux.c +++ b/tests/check/elements/rtpmux.c @@ -50,6 +50,9 @@ query_func (GstPad * pad, GstObject * noparent, GstQuery * query) gst_query_set_caps_result (query, *caps); break; } + case GST_QUERY_ACCEPT_CAPS: + gst_query_set_accept_caps_result (query, TRUE); + break; default: break; } @@ -68,14 +71,17 @@ event_func (GstPad * pad, GstObject * noparent, GstEvent * event) gst_event_parse_caps (event, &caps); fail_unless (caps2 != NULL && *caps2 != NULL); - fail_unless (gst_caps_is_equal (caps, *caps2)); + fail_unless (gst_caps_is_fixed (caps)); + fail_unless (gst_caps_is_fixed (*caps2)); + fail_unless (gst_caps_is_equal_fixed (caps, *caps2)); break; } default: - gst_event_unref (event); break; } + gst_event_unref (event); + return TRUE; }