From: Nicolas Dufresne Date: Sun, 12 May 2013 03:24:36 +0000 (-0400) Subject: rtpmux: Send stream-start before caps X-Git-Tag: 1.19.3~509^2~5814 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04c9f435670b2b7041d458644d47e7cb342eb73f;p=platform%2Fupstream%2Fgstreamer.git rtpmux: Send stream-start before caps --- diff --git a/gst/rtpmanager/gstrtpmux.c b/gst/rtpmanager/gstrtpmux.c index c7315880ba..7e55fc4a37 100644 --- a/gst/rtpmanager/gstrtpmux.c +++ b/gst/rtpmanager/gstrtpmux.c @@ -554,6 +554,16 @@ gst_rtp_mux_setcaps (GstPad * pad, GstRTPMux * rtp_mux, GstCaps * caps) "clock-base", G_TYPE_UINT, rtp_mux->ts_base, "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL); + if (rtp_mux->send_stream_start) { + gchar s_id[32]; + + /* stream-start (FIXME: create id based on input ids) */ + g_snprintf (s_id, sizeof (s_id), "interleave-%08x", g_random_int ()); + gst_pad_push_event (rtp_mux->srcpad, gst_event_new_stream_start (s_id)); + + rtp_mux->send_stream_start = FALSE; + } + GST_DEBUG_OBJECT (rtp_mux, "setting caps %" GST_PTR_FORMAT " on src pad..", caps); ret = gst_pad_set_caps (rtp_mux->srcpad, caps); @@ -815,6 +825,7 @@ gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux) GST_OBJECT_LOCK (rtp_mux); g_clear_object (&rtp_mux->last_pad); + rtp_mux->send_stream_start = TRUE; if (rtp_mux->ssrc == -1) rtp_mux->current_ssrc = g_random_int (); diff --git a/gst/rtpmanager/gstrtpmux.h b/gst/rtpmanager/gstrtpmux.h index 8c87aa241c..3582a75a56 100644 --- a/gst/rtpmanager/gstrtpmux.h +++ b/gst/rtpmanager/gstrtpmux.h @@ -75,6 +75,7 @@ struct _GstRTPMux GstPad *last_pad; /* protected by object lock */ GstClockTime last_stop; + gboolean send_stream_start; }; struct _GstRTPMuxClass diff --git a/tests/check/elements/rtpmux.c b/tests/check/elements/rtpmux.c index 4ced8e7252..2a81294d6e 100644 --- a/tests/check/elements/rtpmux.c +++ b/tests/check/elements/rtpmux.c @@ -148,6 +148,11 @@ test_basic (const gchar * elem_name, const gchar * sink2, int count, gst_pad_set_active (src1, TRUE); gst_pad_set_active (src2, TRUE); + fail_unless (gst_pad_push_event (src1, + gst_event_new_stream_start ("stream1"))); + fail_unless (gst_pad_push_event (src2, + gst_event_new_stream_start ("stream2"))); + gst_caps_set_simple (sinkcaps, "payload", G_TYPE_INT, 98, "seqnum-base", G_TYPE_UINT, 100, "clock-base", G_TYPE_UINT, 1000, "ssrc", G_TYPE_UINT, 66, NULL);