summaryrefslogtreecommitdiff
path: root/display.js
diff options
context:
space:
mode:
authorJeremy White <jwhite@codeweavers.com>2016-09-26 15:41:29 -0500
committerJeremy White <jwhite@codeweavers.com>2016-10-10 11:29:44 -0500
commit57134818c306eca9424b204c105b29b224755201 (patch)
tree8494733d91925de1dad59ad0c506c90a25f0ff39 /display.js
parentfc0a664e7e80fe6dcbbad96f88277bef5a390c06 (diff)
Do not wait for the source buffer open callback to start stream creation.
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.
Diffstat (limited to 'display.js')
-rw-r--r--display.js23
1 files 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);
}