[Spice-devel] [PATCH spice-html5] Only drop an mjpeg frame if we are not currently processing one.

Pavel Grunt pgrunt at redhat.com
Thu Jan 19 10:15:51 UTC 2017


On Thu, 2016-12-29 at 15:28 -0600, Jeremy White wrote:
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
>  display.js | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/display.js b/display.js
> index 6691c5e..c450088 100644
> --- a/display.js
> +++ b/display.js
> @@ -582,7 +582,9 @@
> SpiceDisplayConn.prototype.process_channel_message = function(msg)
>              media.spiceconn = this;
>              v.spice_stream = s;
>          }
> -        else if (m.codec_type != SPICE_VIDEO_CODEC_TYPE_MJPEG)
> +        else if (m.codec_type == SPICE_VIDEO_CODEC_TYPE_MJPEG)
> +            this.streams[m.id].frames_loading = 0;
> +        else
>              console.log("Unhandled stream codec: "+m.codec_type);
>          return true;
>      }
> @@ -884,6 +886,9 @@ function handle_draw_jpeg_onload()
>      var temp_canvas = null;
>      var context;
>  
> +    if (this.o.sc.streams[this.o.id])
> +        this.o.sc.streams[this.o.id].frames_loading--;
> +
>      /*------------------------------------------------------------
>      ** FIXME:
>      **  The helper should be extended to be able to handle actual
> HtmlImageElements
> @@ -970,7 +975,7 @@ function handle_draw_jpeg_onload()
>  
>  function process_mjpeg_stream_data(sc, m, time_until_due)
>  {
> -    if (time_until_due < 0)
> +    if (time_until_due < 0 && sc.streams[m.base.id].frames_loading
> > 0)
Could you please put a comment here describing what is going on - it
can be the same as the commit message. Just to avoid the need for
using git blame

Thanks and ack,
Pavel

>      {
>          if ("report" in sc.streams[m.base.id])
>              sc.streams[m.base.id].report.num_drops++;
> @@ -1001,6 +1006,8 @@ function process_mjpeg_stream_data(sc, m,
> time_until_due)
>          };
>      img.onload = handle_draw_jpeg_onload;
>      img.src = tmpstr;
> +
> +    sc.streams[m.base.id].frames_loading++;
>  }
>  
>  function process_stream_data_report(sc, id, msg_mmtime,
> time_until_due)


More information about the Spice-devel mailing list