[Spice-commits] Branch 'stream2' - 5 commits - src/cursor.js src/display.js src/webm.js

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 7 09:11:07 UTC 2020


Rebased ref, commits from common ancestor:
commit 280ba18a1a2daeb46edcec2f3cd9c5da737af7a4
Author: Jeremy White <jwhite at codeweavers.com>
Date:   Tue Dec 31 10:50:32 2019 -0600

    Make an attempt to follow the rules on auto play videos.
    
    Browsers have stopped allowing auto play videos.  The documented solution
    is to mute your video.  This patch mutes our videos and also attempts to
    start playing if the auto play does not fire.

diff --git a/src/display.js b/src/display.js
index 4941884..f20d6b4 100644
--- a/src/display.js
+++ b/src/display.js
@@ -559,6 +559,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
             var v = document.createElement("video");
             v.src = window.URL.createObjectURL(media);
 
+            v.setAttribute('muted', true);
             v.setAttribute('autoplay', true);
             v.setAttribute('width', m.stream_width);
             v.setAttribute('height', m.stream_height);
@@ -1146,6 +1147,10 @@ function handle_append_video_buffer_done(e)
         stream.video.currentTime = stream.video.buffered.start(stream.video.buffered.length - 1);
     }
 
+    /* Modern browsers try not to auto play video. */
+    if (this.stream.video.paused && this.stream.video.readyState >= 2)
+        var promise = this.stream.video.play();
+
     if (Utils.STREAM_DEBUG > 1)
         console.log(stream.video.currentTime + ":id " +  stream.id + " updateend " + Utils.dump_media_element(stream.video));
 }
commit f894ed0652ad1639cbb5f8af75320a0c21fa05b6
Author: Jeremy White <jwhite at codeweavers.com>
Date:   Tue Dec 31 10:52:12 2019 -0600

    Allow pointer events to go through our videos.
    
    If a video covers up a substantial portion of the screen,
    you can no longer interact with it.
    
    This change allows pointer events to flow through to our canvas.

diff --git a/src/display.js b/src/display.js
index cac0715..4941884 100644
--- a/src/display.js
+++ b/src/display.js
@@ -571,7 +571,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
                 top += this.surfaces[m.surface_id].canvas.offsetTop;
             }
             document.getElementById(this.parent.screen_id).appendChild(v);
-            v.setAttribute('style', "position: absolute; top:" + top + "px; left:" + left + "px;");
+            v.setAttribute('style', "pointer-events:none; position: absolute; top:" + top + "px; left:" + left + "px;");
 
             media.addEventListener('sourceopen', handle_video_source_open, false);
             media.addEventListener('sourceended', handle_video_source_ended, false);
commit 8b238f0eeb15d1e3354be715633596e574eb92a4
Author: Jeremy White <jwhite at codeweavers.com>
Date:   Tue Dec 20 10:39:26 2016 -0600

    Make the audio and video uids different.
    
    This does not appear to matter, but let's just be safe.
    
    Signed-off-by: Jeremy White <jwhite at codeweavers.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/webm.js b/src/webm.js
index 643ccc3..970ac1b 100644
--- a/src/webm.js
+++ b/src/webm.js
@@ -401,7 +401,7 @@ function webm_AudioTrackEntry()
 {
     this.id = WEBM_TRACK_ENTRY;
     this.number = 1;
-    this.uid = 1;
+    this.uid = 2;  // Arbitrary id; most likely makes no difference
     this.type = 2; // Audio
     this.flag_enabled = 1;
     this.flag_default = 1;
commit 4dc2401b75de81da72581143caaee0227faec133
Author: Jeremy White <jwhite at codeweavers.com>
Date:   Mon Dec 19 15:03:24 2016 -0600

    Review the webm video track header and remove the fixmes.
    
    This involved a review of the Firefox parsing code along
    with the official specifcation, and setting these fields
    to the specified default values.
    
    Signed-off-by: Jeremy White <jwhite at codeweavers.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/webm.js b/src/webm.js
index 315afa9..643ccc3 100644
--- a/src/webm.js
+++ b/src/webm.js
@@ -62,6 +62,7 @@ var WEBM_CODEC_PRIVATE =                    [ 0x63, 0xA2 ];
 var WEBM_CODEC_ID =                         [ 0x86 ];
 
 var WEBM_VIDEO =                            [ 0xE0 ] ;
+var WEBM_FLAG_INTERLACED =                  [ 0x9A ] ;
 var WEBM_PIXEL_WIDTH =                      [ 0xB0 ] ;
 var WEBM_PIXEL_HEIGHT =                     [ 0xBA ] ;
 
@@ -303,6 +304,7 @@ webm_Audio.prototype =
 function webm_Video(width, height)
 {
     this.id = WEBM_VIDEO;
+    this.flag_interlaced = 0;
     this.width = width;
     this.height = height;
 }
@@ -315,6 +317,7 @@ webm_Video.prototype =
         var dv = new DataView(a);
         at = EBML_write_array(this.id, dv, at);
         at = EBML_write_u64_data_len(this.buffer_size() - 8 - this.id.length, dv, at);
+        at = EBML_write_u8_value(WEBM_FLAG_INTERLACED, this.flag_interlaced, dv, at);
         at = EBML_write_u16_value(WEBM_PIXEL_WIDTH, this.width, dv, at)
         at = EBML_write_u16_value(WEBM_PIXEL_HEIGHT, this.height, dv, at)
         return at;
@@ -322,6 +325,7 @@ webm_Video.prototype =
     buffer_size: function()
     {
         return this.id.length + 8 +
+            WEBM_FLAG_INTERLACED.length + 1 + 1 +
             WEBM_PIXEL_WIDTH.length + 1 + 2 +
             WEBM_PIXEL_HEIGHT.length + 1 + 2;
     },
@@ -471,20 +475,30 @@ webm_AudioTrackEntry.prototype =
 
 function webm_VideoTrackEntry(width, height)
 {
+    /*
+    ** In general, we follow specifications found by looking here:
+    **   https://www.webmproject.org/docs/container/
+    ** which points here:
+    **   https://www.matroska.org/technical/specs/index.html
+    ** and here:
+    **   https://datatracker.ietf.org/doc/draft-ietf-cellar-matroska/
+    ** Our goal is to supply mandatory values, and note where we differ
+    ** from the default.
+    */
     this.id = WEBM_TRACK_ENTRY;
     this.number = 1;
     this.uid = 1;
     this.type = 1; // Video
     this.flag_enabled = 1;
     this.flag_default = 1;
-    this.flag_forced = 1;
-    this.flag_lacing = 0;
-    this.min_cache = 0; // fixme - check
+    this.flag_forced = 1;  // Different than default; we wish to force
+    this.flag_lacing = 1;
+    this.min_cache = 0;
     this.max_block_addition_id = 0;
-    this.codec_decode_all = 0; // fixme - check
-    this.seek_pre_roll = 0; // 80000000; // fixme - check
-    this.codec_delay =   80000000; // Must match codec_private.preskip
     this.codec_id = "V_VP8";
+    this.codec_decode_all = 1;
+    this.seek_pre_roll = 0;
+
     this.video = new webm_Video(width, height);
 }
 
@@ -506,7 +520,6 @@ webm_VideoTrackEntry.prototype =
         at = EBML_write_u8_value(WEBM_MIN_CACHE, this.min_cache, dv, at);
         at = EBML_write_u8_value(WEBM_MAX_BLOCK_ADDITION_ID, this.max_block_addition_id, dv, at);
         at = EBML_write_u8_value(WEBM_CODEC_DECODE_ALL, this.codec_decode_all, dv, at);
-        at = EBML_write_u32_value(WEBM_CODEC_DELAY, this.codec_delay, dv, at);
         at = EBML_write_u32_value(WEBM_SEEK_PRE_ROLL, this.seek_pre_roll, dv, at);
         at = EBML_write_u8_value(WEBM_TRACK_TYPE, this.type, dv, at);
         at = this.video.to_buffer(a, at);
@@ -525,7 +538,6 @@ webm_VideoTrackEntry.prototype =
             WEBM_MIN_CACHE.length + 1 + 1 +
             WEBM_MAX_BLOCK_ADDITION_ID.length + 1 + 1 +
             WEBM_CODEC_DECODE_ALL.length + 1 + 1 +
-            WEBM_CODEC_DELAY.length + 1 + 4 +
             WEBM_SEEK_PRE_ROLL.length + 1 + 4 +
             WEBM_TRACK_TYPE.length + 1 + 1 +
             this.video.buffer_size();
commit e1da56fe93666cd4c0be652ec78fb6542b5c9f49
Author: Jeremy White <jwhite at codeweavers.com>
Date:   Mon Jan 13 10:14:43 2020 -0600

    Bug fix:  non square cursors were drawn improperly.

diff --git a/src/cursor.js b/src/cursor.js
index a3be8da..c3bc05e 100644
--- a/src/cursor.js
+++ b/src/cursor.js
@@ -126,7 +126,7 @@ SpiceCursorConn.prototype.process_channel_message = function(msg)
 
 SpiceCursorConn.prototype.set_cursor = function(cursor)
 {
-    var pngstr = create_rgba_png(cursor.header.height, cursor.header.width, cursor.data);
+    var pngstr = create_rgba_png(cursor.header.width, cursor.header.height, cursor.data);
     var curstr = 'url(data:image/png,' + pngstr + ') ' +
         cursor.header.hot_spot_x + ' ' + cursor.header.hot_spot_y + ", default";
     var screen = document.getElementById(this.parent.screen_id);


More information about the Spice-commits mailing list