[PATCH spice-html5 3/3] Detect video underrun and advance the current time.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This helps us avoid stalled video streams.

Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx>
---
 display.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/display.js b/display.js
index d4baef7..c97f237 100644
--- a/display.js
+++ b/display.js
@@ -1114,6 +1114,14 @@ function handle_append_video_buffer_done(e)
         return;
     }
 
+    if (stream.video.buffered.length > 0 &&
+        stream.video.currentTime < stream.video.buffered.start(stream.video.buffered.length - 1))
+    {
+        console.log("Video appears to have fallen behind; advancing to " +
+            stream.video.buffered.start(stream.video.buffered.length - 1));
+        stream.video.currentTime = stream.video.buffered.start(stream.video.buffered.length - 1);
+    }
+
     if (STREAM_DEBUG > 1)
         console.log(stream.video.currentTime + ":id " +  stream.id + " updateend " + dump_media_element(stream.video));
 }
-- 
2.1.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]