From: <wt...@ke...> - 2007-12-12 16:59:35
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: wtay Date: Wed Dec 12 2007 16:59:17 UTC Log message: * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_finalize), (gst_rtp_pt_demux_setup), (gst_rtp_pt_demux_release), (gst_rtp_pt_demux_change_state): * gst/rtpmanager/gstrtpssrcdemux.c: (gst_rtp_ssrc_demux_reset), (gst_rtp_ssrc_demux_dispose), (gst_rtp_ssrc_demux_src_query), (gst_rtp_ssrc_demux_change_state): Clean up the dynamic pads when going to READY. Modified files: . : ChangeLog gst/rtpmanager : gstrtpptdemux.c gstrtpssrcdemux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.2926&r2=1.2927 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/rtpmanager/gstrtpptdemux.c.diff?r1=1.13&r2=1.14 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/rtpmanager/gstrtpssrcdemux.c.diff?r1=1.13&r2=1.14 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.2926 retrieving revision 1.2927 diff -u -d -r1.2926 -r1.2927 --- ChangeLog 12 Dec 2007 12:11:52 -0000 1.2926 +++ ChangeLog 12 Dec 2007 16:59:00 -0000 1.2927 @@ -1,5 +1,15 @@ 2007-12-12 Wim Taymans <wim...@co...> + * gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_finalize), + (gst_rtp_pt_demux_setup), (gst_rtp_pt_demux_release), + (gst_rtp_pt_demux_change_state): + * gst/rtpmanager/gstrtpssrcdemux.c: (gst_rtp_ssrc_demux_reset), + (gst_rtp_ssrc_demux_dispose), (gst_rtp_ssrc_demux_src_query), + (gst_rtp_ssrc_demux_change_state): + Clean up the dynamic pads when going to READY. + +2007-12-12 Wim Taymans <wim...@co...> * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_finalize), (gst_rtp_bin_set_sdes_string), (gst_rtp_bin_get_sdes_string), (gst_rtp_bin_handle_message): Index: gstrtpptdemux.c RCS file: /cvs/gstreamer/gst-plugins-bad/gst/rtpmanager/gstrtpptdemux.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- gstrtpptdemux.c 10 Dec 2007 15:34:18 -0000 1.13 +++ gstrtpptdemux.c 12 Dec 2007 16:59:03 -0000 1.14 @@ -126,8 +126,8 @@ static void gst_rtp_pt_demux_finalize (GObject * object); -static void gst_rtp_pt_demux_release (GstElement * element); -static gboolean gst_rtp_pt_demux_setup (GstElement * element); +static void gst_rtp_pt_demux_release (GstRtpPtDemux * ptdemux); +static gboolean gst_rtp_pt_demux_setup (GstRtpPtDemux * ptdemux); static GstFlowReturn gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf); static GstStateChangeReturn gst_rtp_pt_demux_change_state (GstElement * element, @@ -249,7 +249,7 @@ static void gst_rtp_pt_demux_finalize (GObject * object) { - gst_rtp_pt_demux_release (GST_ELEMENT (object)); + gst_rtp_pt_demux_release (GST_RTP_PT_DEMUX (object)); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -426,33 +426,31 @@ * Reserves resources for the object. */ static gboolean -gst_rtp_pt_demux_setup (GstElement * element) +gst_rtp_pt_demux_setup (GstRtpPtDemux * ptdemux) - GstRtpPtDemux *ptdemux = GST_RTP_PT_DEMUX (element); - gboolean res = TRUE; - - if (ptdemux) { - ptdemux->srcpads = NULL; - ptdemux->last_pt = 0xFFFF; - } + ptdemux->srcpads = NULL; + ptdemux->last_pt = 0xFFFF; - return res; + return TRUE; /** * Free resources for the object. -gst_rtp_pt_demux_release (GstElement * element) +gst_rtp_pt_demux_release (GstRtpPtDemux * ptdemux) + GSList *walk; - /* note: GstElement's dispose() will handle the pads */ - g_slist_foreach (ptdemux->srcpads, (GFunc) g_free, NULL); - g_slist_free (ptdemux->srcpads); + for (walk = ptdemux->srcpads; walk; walk = g_slist_next (walk)) { + GstRtpPtDemuxPad *pad = walk->data; + gst_pad_set_active (pad->pad, FALSE); + gst_element_remove_pad (GST_ELEMENT_CAST (ptdemux), pad->pad); + g_free (pad); } + g_slist_free (ptdemux->srcpads); static GstStateChangeReturn @@ -465,7 +463,7 @@ switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: - if (gst_rtp_pt_demux_setup (element) != TRUE) + if (gst_rtp_pt_demux_setup (ptdemux) != TRUE) ret = GST_STATE_CHANGE_FAILURE; break; case GST_STATE_CHANGE_READY_TO_PAUSED: @@ -481,7 +479,7 @@ case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_READY_TO_NULL: - gst_rtp_pt_demux_release (element); + gst_rtp_pt_demux_release (ptdemux); default: Index: gstrtpssrcdemux.c RCS file: /cvs/gstreamer/gst-plugins-bad/gst/rtpmanager/gstrtpssrcdemux.c,v --- gstrtpssrcdemux.c 10 Dec 2007 15:34:18 -0000 1.13 +++ gstrtpssrcdemux.c 12 Dec 2007 16:59:03 -0000 1.14 @@ -309,15 +309,32 @@ +gst_rtp_ssrc_demux_reset (GstRtpSsrcDemux * demux) +{ + for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) { + GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data; + gst_pad_set_active (dpad->rtp_pad, FALSE); + gst_pad_set_active (dpad->rtcp_pad, FALSE); + gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtp_pad); + gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtcp_pad); + g_free (dpad); + } + g_slist_free (demux->srcpads); + demux->srcpads = NULL; +} +static void gst_rtp_ssrc_demux_dispose (GObject * object) GstRtpSsrcDemux *demux; demux = GST_RTP_SSRC_DEMUX (object); - g_slist_foreach (demux->srcpads, (GFunc) g_free, NULL); - g_slist_free (demux->srcpads); - demux->srcpads = NULL; + gst_rtp_ssrc_demux_reset (demux); G_OBJECT_CLASS (parent_class)->dispose (object); @@ -592,12 +609,6 @@ "latency for SSRC %08x, latency %" GST_TIME_FORMAT, demuxpad->ssrc, GST_TIME_ARGS (demuxpad->first_ts)); -#if 0 - min_latency += demuxpad->first_ts; - if (max_latency != -1) - max_latency += demuxpad->first_ts; -#endif gst_query_set_latency (query, live, min_latency, max_latency); } @@ -633,6 +644,8 @@ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + gst_rtp_ssrc_demux_reset (demux); + break; |