<div dir="ltr"><span style="font-size:12.8px">Hi,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I don't think so. Why do you think it would be better?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Tomáš</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-09-07 10:50 GMT+02:00 Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank">fziglio@redhat.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">><br>
> ---<br>
>  display.js   | 26 ++++++++++++++++++++------<br>
>  spiceconn.js |  2 ++<br>
>  webm.js      | 12 ++++++++++--<br>
>  3 files changed, 32 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/display.js b/display.js<br>
> index 0868f91..abd5b1a 100644<br>
> --- a/display.js<br>
> +++ b/display.js<br>
> @@ -543,7 +543,8 @@ SpiceDisplayConn.prototype.<wbr>process_channel_message =<br>
> function(msg)<br>
>          else<br>
>              this.streams[<a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>] = m;<br>
><br>
> -        if (m.codec_type == SPICE_VIDEO_CODEC_TYPE_VP8)<br>
> +        if (m.codec_type == SPICE_VIDEO_CODEC_TYPE_VP8 ||<br>
> +            m.codec_type == SPICE_VIDEO_CODEC_TYPE_VP9)<br>
>          {<br>
>              var media = new MediaSource();<br>
>              var v = document.createElement("video"<wbr>);<br>
> @@ -606,7 +607,8 @@ SpiceDisplayConn.prototype.<wbr>process_channel_message =<br>
> function(msg)<br>
>          if (this.streams[<a href="http://m.base.id" rel="noreferrer" target="_blank">m.base.id</a>].<wbr>codec_type ===<br>
>          SPICE_VIDEO_CODEC_TYPE_MJPEG)<br>
>              process_mjpeg_stream_data(<wbr>this, m, time_until_due);<br>
><br>
> -        if (this.streams[<a href="http://m.base.id" rel="noreferrer" target="_blank">m.base.id</a>].<wbr>codec_type ===<br>
> SPICE_VIDEO_CODEC_TYPE_VP8)<br>
> +        if (this.streams[<a href="http://m.base.id" rel="noreferrer" target="_blank">m.base.id</a>].<wbr>codec_type ===<br>
> SPICE_VIDEO_CODEC_TYPE_VP8 ||<br>
> +            this.streams[<a href="http://m.base.id" rel="noreferrer" target="_blank">m.base.id</a>].codec_<wbr>type ===<br>
> SPICE_VIDEO_CODEC_TYPE_VP9)<br>
>              process_video_stream_data(<wbr>this.streams[<a href="http://m.base.id" rel="noreferrer" target="_blank">m.base.id</a>], m);<br>
><br>
>          return true;<br>
> @@ -640,7 +642,8 @@ SpiceDisplayConn.prototype.<wbr>process_channel_message =<br>
> function(msg)<br>
>          var m = new SpiceMsgDisplayStreamDestroy(<wbr>msg.data);<br>
>          STREAM_DEBUG > 0 && console.log(this.type + ": MsgStreamDestroy id"<br>
>          + <a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>);<br>
><br>
> -        if (this.streams[<a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>].codec_type == SPICE_VIDEO_CODEC_TYPE_VP8)<br>
> +        if (this.streams[<a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>].codec_type == SPICE_VIDEO_CODEC_TYPE_VP8 ||<br>
> +            this.streams[<a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>].codec_type == SPICE_VIDEO_CODEC_TYPE_VP9)<br>
>          {<br>
>              document.getElementById(this.<wbr>parent.screen_id).removeChild(<wbr>this.streams[<a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>].video);<br>
>              this.streams[<a href="http://m.id" rel="noreferrer" target="_blank">m.id</a>].source_<wbr>buffer = null;<br>
> @@ -1036,14 +1039,24 @@ function handle_video_source_open(e)<br>
>  {<br>
>      var stream = this.stream;<br>
>      var p = this.spiceconn;<br>
> +    var codec_type;<br>
><br>
>      if (stream.source_buffer)<br>
>          return;<br>
><br>
> -    var s = this.addSourceBuffer(SPICE_<wbr>VP8_CODEC);<br>
> +    if (this.stream.codec_type == SPICE_VIDEO_CODEC_TYPE_VP8)<br>
> +    {<br>
> +        codec_type = SPICE_VP8_CODEC;<br>
> +    }<br>
> +    else<br>
> +    {<br>
> +        codec_type = SPICE_VP9_CODEC;<br>
> +    }<br>
> +<br>
<br>
</div></div>Would not be better to use a switch ?<br>
<div class="HOEnZb"><div class="h5"><br>
> +    var s = this.addSourceBuffer(codec_<wbr>type);<br>
>      if (! s)<br>
>      {<br>
> -        p.log_err('Codec ' + SPICE_VP8_CODEC + ' not available.');<br>
> +        p.log_err('Codec ' + codec_type + ' not available.');<br>
>          return;<br>
>      }<br>
><br>
> @@ -1054,7 +1067,8 @@ function handle_video_source_open(e)<br>
>      listen_for_video_events(<wbr>stream);<br>
><br>
>      var h = new webm_Header();<br>
> -    var te = new webm_VideoTrackEntry(this.<wbr>stream.stream_width,<br>
> this.stream.stream_height);<br>
> +    var te = new webm_VideoTrackEntry(this.<wbr>stream.stream_width,<br>
> this.stream.stream_height,<br>
> +                                      this.stream.codec_type);<br>
>      var t = new webm_Tracks(te);<br>
><br>
>      var mb = new ArrayBuffer(h.buffer_size() + t.buffer_size())<br>
> diff --git a/spiceconn.js b/spiceconn.js<br>
> index 78d5820..4c7bcaf 100644<br>
> --- a/spiceconn.js<br>
> +++ b/spiceconn.js<br>
> @@ -147,6 +147,8 @@ SpiceConn.prototype =<br>
>                          (1 << SPICE_DISPLAY_CAP_CODEC_MJPEG)<wbr>;<br>
>              if ('MediaSource' in window &&<br>
>              MediaSource.isTypeSupported(<wbr>SPICE_VP8_CODEC))<br>
>                  caps |= (1 << SPICE_DISPLAY_CAP_CODEC_VP8);<br>
> +            if ('MediaSource' in window &&<br>
> MediaSource.isTypeSupported(<wbr>SPICE_VP9_CODEC))<br>
> +                caps |= (1 << SPICE_DISPLAY_CAP_CODEC_VP9);<br>
>              msg.channel_caps.push(caps);<br>
>          }<br>
><br>
> diff --git a/webm.js b/webm.js<br>
> index 789da14..c697135 100644<br>
> --- a/webm.js<br>
> +++ b/webm.js<br>
> @@ -88,6 +88,7 @@ var EXPECTED_PACKET_DURATION                = 10;<br>
>  var GAP_DETECTION_THRESHOLD                 = 50;<br>
><br>
>  var SPICE_VP8_CODEC                         = 'video/webm; codecs="vp8"';<br>
> +var SPICE_VP9_CODEC                         = 'video/webm; codecs="vp9"';<br>
><br>
>  /*----------------------------<wbr>------------------------------<wbr>------------------<br>
>  **  EBML utility functions<br>
> @@ -467,7 +468,7 @@ webm_AudioTrackEntry.prototype =<br>
>      },<br>
>  }<br>
><br>
> -function webm_VideoTrackEntry(width, height)<br>
> +function webm_VideoTrackEntry(width, height, codec_type)<br>
>  {<br>
>      <a href="http://this.id" rel="noreferrer" target="_blank">this.id</a> = WEBM_TRACK_ENTRY;<br>
>      this.number = 1;<br>
> @@ -482,8 +483,15 @@ function webm_VideoTrackEntry(width, height)<br>
>      this.codec_decode_all = 0; // fixme - check<br>
>      this.seek_pre_roll = 0; // 80000000; // fixme - check<br>
>      this.codec_delay =   80000000; // Must match codec_private.preskip<br>
> -    this.codec_id = "V_VP8";<br>
>      this.video = new webm_Video(width, height);<br>
> +    if (codec_type == SPICE_VIDEO_CODEC_TYPE_VP8)<br>
> +    {<br>
> +        this.codec_id = "V_VP8";<br>
> +    }<br>
> +    else<br>
> +    {<br>
> +        this.codec_id = "V_VP9";<br>
> +    }<br>
>  }<br>
><br>
>  webm_VideoTrackEntry.prototype =<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">Frediano<br>
</font></span></blockquote></div><br></div>