gst/rtsp/gstrtspsrc.*: Set timestamps on RTP buffers in interleaved mode.

Original commit message from CVS:
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_create_stream),
(gst_rtspsrc_handle_src_query), (gst_rtspsrc_loop_interleaved),
(gst_rtspsrc_loop_udp), (gst_rtspsrc_close):
* gst/rtsp/gstrtspsrc.h:
Set timestamps on RTP buffers in interleaved mode.
Mark first buffers with a DISCONT.
Remove flush hack now that sync for live sources has been figured out.
This commit is contained in:
Wim Taymans 2007-09-26 20:12:52 +00:00
parent 285ec58919
commit 4683ff80d3
3 changed files with 30 additions and 8 deletions

View file

@ -1,3 +1,13 @@
2007-09-26 Wim Taymans <wim.taymans@gmail.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_create_stream),
(gst_rtspsrc_handle_src_query), (gst_rtspsrc_loop_interleaved),
(gst_rtspsrc_loop_udp), (gst_rtspsrc_close):
* gst/rtsp/gstrtspsrc.h:
Set timestamps on RTP buffers in interleaved mode.
Mark first buffers with a DISCONT.
Remove flush hack now that sync for live sources has been figured out.
2007-09-26 Wim Taymans <wim.taymans@gmail.com> 2007-09-26 Wim Taymans <wim.taymans@gmail.com>
* gst/udp/gstudpsrc.c: (gst_udpsrc_create): * gst/udp/gstudpsrc.c: (gst_udpsrc_create):

View file

@ -556,6 +556,8 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
stream->added = FALSE; stream->added = FALSE;
stream->disabled = FALSE; stream->disabled = FALSE;
stream->id = src->numstreams++; stream->id = src->numstreams++;
stream->eos = FALSE;
stream->discont = TRUE;
/* we must have a payload. No payload means we cannot create caps */ /* we must have a payload. No payload means we cannot create caps */
/* FIXME, handle multiple formats. */ /* FIXME, handle multiple formats. */
@ -1358,7 +1360,7 @@ gst_rtspsrc_handle_src_query (GstPad * pad, GstQuery * query)
} }
case GST_QUERY_LATENCY: case GST_QUERY_LATENCY:
{ {
/* we are live with a min latency of 0 and unlimted max latency */ /* we are live with a min latency of 0 and unlimited max latency */
gst_query_set_latency (query, TRUE, 0, -1); gst_query_set_latency (query, TRUE, 0, -1);
break; break;
} }
@ -2448,6 +2450,15 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
/* don't need message anymore */ /* don't need message anymore */
gst_rtsp_message_unset (&message); gst_rtsp_message_unset (&message);
/* set reception timestamp */
GST_OBJECT_LOCK (src);
if (GST_ELEMENT_CLOCK (src)) {
GstClockTime now = gst_clock_get_time (GST_ELEMENT_CLOCK (src));
GST_BUFFER_TIMESTAMP (buf) = now - GST_ELEMENT_CAST (src)->base_time;
}
GST_OBJECT_UNLOCK (src);
GST_DEBUG_OBJECT (src, "pushing data of size %d on channel %d", size, GST_DEBUG_OBJECT (src, "pushing data of size %d on channel %d", size,
channel); channel);
@ -2462,6 +2473,12 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
gst_buffer_set_caps (buf, stream->caps); gst_buffer_set_caps (buf, stream->caps);
} }
if (stream->discont && !is_rtcp) {
/* mark first RTP buffer as discont */
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
stream->discont = FALSE;
}
/* chain to the peer pad */ /* chain to the peer pad */
if (GST_PAD_IS_SINK (outpad)) if (GST_PAD_IS_SINK (outpad))
ret = gst_pad_chain (outpad, buf); ret = gst_pad_chain (outpad, buf);
@ -2662,12 +2679,6 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src)
if (!gst_rtspsrc_open (src)) if (!gst_rtspsrc_open (src))
goto open_failed; goto open_failed;
/* flush previous state */
gst_element_post_message (GST_ELEMENT_CAST (src),
gst_message_new_async_start (GST_OBJECT_CAST (src), TRUE));
gst_element_post_message (GST_ELEMENT_CAST (src),
gst_message_new_async_done (GST_OBJECT_CAST (src)));
/* start playback */ /* start playback */
if (!gst_rtspsrc_play (src)) if (!gst_rtspsrc_play (src))
goto play_failed; goto play_failed;
@ -3872,7 +3883,7 @@ gst_rtspsrc_close (GstRTSPSrc * src)
GST_RTSP_STREAM_LOCK (src); GST_RTSP_STREAM_LOCK (src);
GST_RTSP_STREAM_UNLOCK (src); GST_RTSP_STREAM_UNLOCK (src);
/* no wait for the task to finish */ /* now wait for the task to finish */
gst_task_join (src->task); gst_task_join (src->task);
/* and free the task */ /* and free the task */

View file

@ -95,6 +95,7 @@ struct _GstRTSPStream {
gboolean added; gboolean added;
gboolean disabled; gboolean disabled;
gboolean eos; gboolean eos;
gboolean discont;
/* for interleaved mode */ /* for interleaved mode */
guint8 channel[2]; guint8 channel[2];