All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhou qi <atmgnd@outlook.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [PATCH] Fix video playback slowdown when spice client no audio enabled
Date: Thu, 10 Sep 2020 11:17:13 +0000	[thread overview]
Message-ID: <SYBP282MB00121EE06C845D33A07413BAC9270@SYBP282MB0012.AUSP282.PROD.OUTLOOK.COM> (raw)

From e8c2e283f0954de255a32ea70d577d5e61992399 Mon Sep 17 00:00:00 2001
From: Qi Zhou <atmgnd@outlook.com>
Date: Thu, 10 Sep 2020 19:09:29 +0800
Subject: [PATCH] Fix video playback slowdown when spice client no audio enabled

You will get video playback slowdown on the following cases

1. use official spice client with audio channel disabled, use --spice-disable-audio
   option
2. thirtpart client doesn't implement audio channel

ref: https://github.com/qemu/qemu/commit/fb35c2cec58985f0b8d2733f1b91927542eeb3fd
Signed-off-by: Qi Zhou <atmgnd@outlook.com>
---
 audio/audio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/audio/audio.c b/audio/audio.c
index ce8c6dec5f..50febe190f 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1091,7 +1091,11 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live)
     while (live) {
         size_t size, decr, proc;
         void *buf = hw->pcm_ops->get_buffer_out(hw, &size);
-        if (!buf || size == 0) {
+
+        if (!buf) {
+            hw->mix_buf->pos = (hw->mix_buf->pos + live) % hw->mix_buf->size;
+            return clipped + live;
+        } else if ( size == 0) {
             break;
         }
 
-- 
2.17.1

             reply	other threads:[~2020-09-10 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 11:17 zhou qi [this message]
2020-09-11 11:53 ` 转发: [PATCH RESEND] Fix video playback slowdown when spice client no audio enabled zhou qi
2020-09-13 12:27 ` [PATCH] " Volker Rümelin
2020-09-17 17:22   ` Volker Rümelin
2020-09-19  9:41     ` 回复: " zhou qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SYBP282MB00121EE06C845D33A07413BAC9270@SYBP282MB0012.AUSP282.PROD.OUTLOOK.COM \
    --to=atmgnd@outlook.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.