gst/rtsp/gstrtspsrc.*: Set timestamps on RTP buffers in interleaved mode.
authorWim Taymans <wim.taymans@gmail.com>
Wed, 26 Sep 2007 20:12:52 +0000 (20:12 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 26 Sep 2007 20:12:52 +0000 (20:12 +0000)
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.

ChangeLog
gst/rtsp/gstrtspsrc.c
gst/rtsp/gstrtspsrc.h

index 545855c..4f48597 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 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>
+
        * gst/udp/gstudpsrc.c: (gst_udpsrc_create):
        Update documentation.
 
index 319f59d..7a30930 100644 (file)
@@ -556,6 +556,8 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
   stream->added = FALSE;
   stream->disabled = FALSE;
   stream->id = src->numstreams++;
+  stream->eos = FALSE;
+  stream->discont = TRUE;
 
   /* we must have a payload. No payload means we cannot create caps */
   /* FIXME, handle multiple formats. */
@@ -1358,7 +1360,7 @@ gst_rtspsrc_handle_src_query (GstPad * pad, GstQuery * query)
     }
     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);
       break;
     }
@@ -2448,6 +2450,15 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
   /* don't need message anymore */
   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,
       channel);
 
@@ -2462,6 +2473,12 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
     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 */
   if (GST_PAD_IS_SINK (outpad))
     ret = gst_pad_chain (outpad, buf);
@@ -2662,12 +2679,6 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src)
   if (!gst_rtspsrc_open (src))
     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 */
   if (!gst_rtspsrc_play (src))
     goto play_failed;
@@ -3872,7 +3883,7 @@ gst_rtspsrc_close (GstRTSPSrc * src)
     GST_RTSP_STREAM_LOCK (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);
 
     /* and free the task */
index 7a3b6e1..d956d7e 100644 (file)
@@ -95,6 +95,7 @@ struct _GstRTSPStream {
   gboolean      added;
   gboolean      disabled;
   gboolean      eos;
+  gboolean      discont;
 
   /* for interleaved mode */
   guint8        channel[2];