[Spice-devel] [spice-html5 stream 1/5] Do not wait for the source buffer open callback to start stream creation.

Jeremy White jwhite at codeweavers.com
Wed Sep 28 20:32:00 UTC 2016


Otherwise, we end up discarding stream data messages, and our decode
can become corrupted, notably on Chrome.

This way, we should not lose any messages while we are waiting for
source buffer creation.

Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 display.js | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/display.js b/display.js
index d8239c2..9fc13c0 100644
--- a/display.js
+++ b/display.js
@@ -567,12 +567,17 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
             media.addEventListener('sourceended', handle_video_source_ended, false);
             media.addEventListener('sourceclosed', handle_video_source_closed, false);
 
-            this.streams[m.id].video = v;
-            this.streams[m.id].media = media;
-
-            media.stream = this.streams[m.id];
+            var s = this.streams[m.id];
+            s.video = v;
+            s.media = media;
+            s.queue = new Array();
+            s.start_time = 0;
+            s.cluster_time = 0;
+            s.append_okay = false;
+
+            media.stream = s;
             media.spiceconn = this;
-            v.spice_stream = this.streams[m.id];
+            v.spice_stream = s;
         }
         else if (m.codec_type != SPICE_VIDEO_CODEC_TYPE_MJPEG)
             console.log("Unhandled stream codec: "+m.codec_type);
@@ -1035,10 +1040,6 @@ function handle_video_source_open(e)
     s.spiceconn = p;
     s.stream = stream;
 
-    stream.queue = new Array();
-    stream.start_time = 0;
-    stream.cluster_time = 0;
-
     listen_for_video_events(stream);
 
     var h = new webm_Header();
@@ -1153,13 +1154,9 @@ function new_video_cluster(stream, msg)
 
 function process_video_stream_data(stream, msg)
 {
-    if (! stream.source_buffer)
-        return true;
-
     if (stream.start_time == 0)
     {
         stream.start_time = msg.base.multi_media_time;
-        stream.video.play();
         new_video_cluster(stream, msg);
     }
 
-- 
2.1.4



More information about the Spice-devel mailing list