rtpmux: Send stream-start before caps

This commit is contained in:
Nicolas Dufresne 2013-05-11 23:24:36 -04:00 committed by Sebastian Dröge
parent 7719b19aec
commit 04c9f43567
3 changed files with 17 additions and 0 deletions

View file

@ -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 ();

View file

@ -75,6 +75,7 @@ struct _GstRTPMux
GstPad *last_pad; /* protected by object lock */
GstClockTime last_stop;
gboolean send_stream_start;
};
struct _GstRTPMuxClass

View file

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