diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-03-25 15:11:34 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-03-26 17:54:08 -0400 |
commit | 84725d62b57bc74ce34abde755f35bf8f948f94d (patch) | |
tree | c061876a7fc4748b1cf90e9746b46fe117d6b06e /gst | |
parent | c3bb399fd3e238da77aa3242557eedf3f42d1167 (diff) |
rtspsrc: Fix segment in TCP mode
It is expected that buffers are time-stamped with running time. Set
a segment accordingly. In this case we pick 0,-1 as this is what udpsrc
would do. Depayloaders will update the segment to reflect the playback
position.
https://bugzilla.gnome.org/show_bug.cgi?id=635701
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtsp/gstrtspsrc.c | 37 | ||||
-rw-r--r-- | gst/rtsp/gstrtspsrc.h | 2 |
2 files changed, 15 insertions, 24 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 222570752..59258d4b2 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -1661,10 +1661,9 @@ gst_rtspsrc_cleanup (GstRTSPSrc * src) gst_sdp_message_free (src->sdp); src->sdp = NULL; } - if (src->start_segment) { - gst_event_unref (src->start_segment); - src->start_segment = NULL; - } + + src->need_segment = FALSE; + if (src->provided_clock) { gst_object_unref (src->provided_clock); src->provided_clock = NULL; @@ -4541,7 +4540,6 @@ gst_rtspsrc_handle_data (GstRTSPSrc * src, GstRTSPMessage * message) guint size; GstBuffer *buf; gboolean is_rtcp; - GstEvent *event; channel = message->type_data.data.channel; @@ -4598,15 +4596,12 @@ gst_rtspsrc_handle_data (GstRTSPSrc * src, GstRTSPMessage * message) gchar *uri; GList *streams; guint group_id = gst_util_group_id_next (); - GstSegment segment; /* generate an SHA256 sum of the URI */ cs = g_checksum_new (G_CHECKSUM_SHA256); uri = src->conninfo.location; g_checksum_update (cs, (const guchar *) uri, strlen (uri)); - gst_segment_init (&segment, GST_FORMAT_TIME); - for (streams = src->streams; streams; streams = g_list_next (streams)) { GstRTSPStream *ostream = (GstRTSPStream *) streams->data; GstCaps *caps; @@ -4649,23 +4644,12 @@ gst_rtspsrc_handle_data (GstRTSPSrc * src, GstRTSPMessage * message) } } } - - /* Push a SEGMENT event if we don't have one pending, if we have one - * pending we will just send that one a few lines below to all pads - */ - if (!src->start_segment) - gst_rtspsrc_stream_push_event (src, ostream, - gst_event_new_segment (&segment)); } g_checksum_free (cs); gst_rtspsrc_activate_streams (src); src->need_activate = FALSE; - } - - if ((event = src->start_segment) != NULL) { - src->start_segment = NULL; - gst_rtspsrc_push_event (src, event); + src->need_segment = TRUE; } if (src->base_time == -1) { @@ -4692,6 +4676,15 @@ gst_rtspsrc_handle_data (GstRTSPSrc * src, GstRTSPMessage * message) GST_OBJECT_UNLOCK (src); } + /* If needed send a new segment, don't forget we are live and buffer are + * timestamped with running time */ + if (src->need_segment) { + GstSegment segment; + src->need_segment = FALSE; + gst_segment_init (&segment, GST_FORMAT_TIME); + gst_rtspsrc_push_event (src, gst_event_new_segment (&segment)); + } + if (stream->discont && !is_rtcp) { /* mark first RTP buffer as discont */ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT); @@ -7535,9 +7528,7 @@ gst_rtspsrc_play (GstRTSPSrc * src, GstSegment * segment, gboolean async) gst_rtsp_message_take_header (&request, GST_RTSP_HDR_RANGE, hval); /* store the newsegment event so it can be sent from the streaming thread. */ - if (src->start_segment) - gst_event_unref (src->start_segment); - src->start_segment = gst_event_new_segment (segment); + src->need_segment = TRUE; } if (segment->rate != 1.0) { diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index 3d94dbb4a..730ea9795 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -185,7 +185,7 @@ struct _GstRTSPSrc { gboolean need_range; gboolean skip; gint free_channel; - GstEvent *start_segment; + gboolean need_segment; GstClockTime base_time; /* UDP mode loop */ |