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

Pavel Grunt pgrunt at redhat.com
Mon Oct 3 09:18:30 UTC 2016


On Wed, 2016-09-28 at 15:32 -0500, Jeremy White wrote:
> 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>
Acked-by: Pavel Grunt <pgrunt at redhat.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);
>      }
>  
> 


More information about the Spice-devel mailing list