rtspsrc: avoid some flushes
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 26 Jun 2013 12:58:53 +0000 (14:58 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 26 Jun 2013 12:58:53 +0000 (14:58 +0200)
gst/rtsp/gstrtspsrc.c
gst/rtsp/gstrtspsrc.h

index 8e301e34f4120eff2330eb7bb62b4004339d8b05..8f6a28eb542a8ac9ff25752bad37634f15562d0c 100644 (file)
@@ -3631,15 +3631,18 @@ gst_rtspsrc_connection_flush (GstRTSPSrc * src, gboolean flush)
 
   GST_DEBUG_OBJECT (src, "set flushing %d", flush);
   GST_RTSP_STATE_LOCK (src);
-  if (src->conninfo.connection) {
+  if (src->conninfo.connection && src->conninfo.flushing != flush) {
     GST_DEBUG_OBJECT (src, "connection flush");
     gst_rtsp_connection_flush (src->conninfo.connection, flush);
+    src->conninfo.flushing = flush;
   }
   for (walk = src->streams; walk; walk = g_list_next (walk)) {
     GstRTSPStream *stream = (GstRTSPStream *) walk->data;
-    GST_DEBUG_OBJECT (src, "stream %p flush", stream);
-    if (stream->conninfo.connection)
+    if (stream->conninfo.connection && stream->conninfo.flushing != flush) {
+      GST_DEBUG_OBJECT (src, "stream %p flush", stream);
       gst_rtsp_connection_flush (stream->conninfo.connection, flush);
+      stream->conninfo.flushing = flush;
+    }
   }
   GST_RTSP_STATE_UNLOCK (src);
 }
@@ -4006,8 +4009,7 @@ server_eof:
 interrupt:
   {
     gst_rtsp_message_unset (&message);
-    GST_DEBUG_OBJECT (src, "got interrupted: stop connection flush");
-    gst_rtspsrc_connection_flush (src, FALSE);
+    GST_DEBUG_OBJECT (src, "got interrupted");
     return GST_FLOW_FLUSHING;
   }
 receive_error:
@@ -4139,8 +4141,7 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src)
 interrupt:
   {
     gst_rtsp_message_unset (&message);
-    GST_DEBUG_OBJECT (src, "got interrupted: stop connection flush");
-    gst_rtspsrc_connection_flush (src, FALSE);
+    GST_DEBUG_OBJECT (src, "got interrupted");
     return GST_FLOW_FLUSHING;
   }
 connect_error:
index a2c47a5a84a1128141fc5e40e3d8e099c331ab43..751c699649f53e35b5d9f6ccae3f07298137eb98 100644 (file)
@@ -87,6 +87,7 @@ struct _GstRTSPConnInfo {
   gchar              *url_str;
   GstRTSPConnection  *connection;
   gboolean            connected;
+  gboolean            flushing;
 };
 
 typedef struct _GstRTSPStream GstRTSPStream;