multihandlesink: Update current time after every write
authorSebastian Dröge <slomo@circular-chaos.org>
Sun, 28 Jul 2013 11:20:48 +0000 (13:20 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Sun, 28 Jul 2013 11:22:17 +0000 (13:22 +0200)
Each write will update the last_activity_time and otherwise we would
compare against a too old current time and immediately timeout because
current time is smaller than last activity time (overflow).

gst/tcp/gstmultihandlesink.c

index ac523a3..5f1c469 100644 (file)
@@ -1691,9 +1691,6 @@ gst_multi_handle_sink_queue_buffer (GstMultiHandleSink * mhsink,
   GstMultiHandleSinkClass *mhsinkclass =
       GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
 
-  g_get_current_time (&nowtv);
-  now = GST_TIMEVAL_TO_TIME (nowtv);
-
   CLIENTS_LOCK (mhsink);
   /* add buffer to queue */
   g_array_prepend_val (mhsink->bufqueue, buffer);
@@ -1719,6 +1716,9 @@ restart:
   for (clients = mhsink->clients; clients; clients = next) {
     GstMultiHandleClient *mhclient = clients->data;
 
+    g_get_current_time (&nowtv);
+    now = GST_TIMEVAL_TO_TIME (nowtv);
+
     if (cookie != mhsink->clients_cookie) {
       GST_DEBUG_OBJECT (sink, "Clients cookie outdated, restarting");
       goto restart;