From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42384 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB8UT-0005Mf-WC for qemu-devel@nongnu.org; Wed, 27 Oct 2010 12:04:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PB8UR-0007HO-U5 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 12:04:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PB8UR-0007Gy-Ng for qemu-devel@nongnu.org; Wed, 27 Oct 2010 12:04:39 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9RG4ccr007114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Oct 2010 12:04:38 -0400 From: Gerd Hoffmann Date: Wed, 27 Oct 2010 18:04:30 +0200 Message-Id: <1288195475-3807-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1288195475-3807-1-git-send-email-kraxel@redhat.com> References: <1288195475-3807-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 1/6] pa: allow processing buffer pieces List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 --- 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