qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] pa: allow processing buffer pieces
Date: Wed, 27 Oct 2010 18:04:30 +0200	[thread overview]
Message-ID: <1288195475-3807-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1288195475-3807-1-git-send-email-kraxel@redhat.com>

Remove some state update dependencies between the pulseaudio worker
threads and main thread.  The worker threads can process the buffer
piecewise now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 audio/paaudio.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/audio/paaudio.c b/audio/paaudio.c
index ff71dac..f768ca9 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -83,7 +83,7 @@ static void *qpa_thread_out (void *arg)
         }
 
         decr = to_mix = pa->live;
-        rpos = hw->rpos;
+        rpos = pa->rpos;
 
         if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) {
             return NULL;
@@ -110,8 +110,8 @@ static void *qpa_thread_out (void *arg)
             return NULL;
         }
 
-        pa->live = 0;
         pa->rpos = rpos;
+        pa->live -= decr;
         pa->decr += decr;
     }
 
@@ -178,7 +178,7 @@ static void *qpa_thread_in (void *arg)
         }
 
         incr = to_grab = pa->dead;
-        wpos = hw->wpos;
+        wpos = pa->wpos;
 
         if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) {
             return NULL;
@@ -323,6 +323,7 @@ static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
     audio_pcm_init_info (&hw->info, &obt_as);
     hw->samples = conf.samples;
     pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
+    pa->rpos = hw->rpos;
     if (!pa->pcm_buf) {
         dolog ("Could not allocate buffer (%d bytes)\n",
                hw->samples << hw->info.shift);
@@ -377,6 +378,7 @@ static int qpa_init_in (HWVoiceIn *hw, struct audsettings *as)
     audio_pcm_init_info (&hw->info, &obt_as);
     hw->samples = conf.samples;
     pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
+    pa->wpos = hw->wpos;
     if (!pa->pcm_buf) {
         dolog ("Could not allocate buffer (%d bytes)\n",
                hw->samples << hw->info.shift);
-- 
1.7.1

  reply	other threads:[~2010-10-27 16:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 16:04 [Qemu-devel] [PATCH 0/6] The windows 7 audio support patch series Gerd Hoffmann
2010-10-27 16:04 ` Gerd Hoffmann [this message]
2010-10-27 16:04 ` [Qemu-devel] [PATCH 2/6] pa: process 1/4 buffer max at once Gerd Hoffmann
2010-10-27 16:04 ` [Qemu-devel] [PATCH 3/6] pa: setup buffer attrs Gerd Hoffmann
2010-10-27 16:04 ` [Qemu-devel] [PATCH 4/6] pa: tweak config Gerd Hoffmann
2010-10-27 16:04 ` [Qemu-devel] [PATCH 5/6] Add support for a USB audio device model Gerd Hoffmann
2010-10-27 17:13   ` [Qemu-devel] " H. Peter Anvin
2010-10-28  8:01     ` Gerd Hoffmann
2010-10-28 15:23       ` H. Peter Anvin
2010-10-28 16:13         ` Gerd Hoffmann
2010-10-28 15:28       ` H. Peter Anvin
2010-10-28 15:29       ` H. Peter Anvin
2010-10-27 16:04 ` [Qemu-devel] [PATCH 6/6] Add Intel HD Audio support to qemu Gerd Hoffmann
2010-10-27 17:46 ` [Qemu-devel] [PATCH 0/6] The windows 7 audio support patch series malc
2010-10-27 17:51   ` malc
2010-10-28  8:47   ` Gerd Hoffmann
2010-10-28  9:46     ` malc
2010-10-28 10:06       ` malc
2010-10-28 10:06       ` Gerd Hoffmann
2010-10-28 22:21       ` Gerd Hoffmann

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=1288195475-3807-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).