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
This commit is contained in:
Olivier Crête 2012-09-10 20:38:14 -04:00 committed by Tim-Philipp Müller
parent 83262be703
commit 15dfdc58d4
2 changed files with 28 additions and 8 deletions

View file

@ -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

View file

@ -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;
}