From patchwork Thu Aug 6 18:28:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 504792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E9C07140285 for ; Fri, 7 Aug 2015 05:39:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ZA423acb; dkim-atps=neutral Received: from localhost ([::1]:46406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNR0q-0004Zu-Rl for incoming@patchwork.ozlabs.org; Thu, 06 Aug 2015 15:39:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNPuD-00082D-1T for qemu-devel@nongnu.org; Thu, 06 Aug 2015 14:28:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNPuB-0001Dc-Gw for qemu-devel@nongnu.org; Thu, 06 Aug 2015 14:28:40 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:33058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNPuB-0001DB-9A for qemu-devel@nongnu.org; Thu, 06 Aug 2015 14:28:39 -0400 Received: by wijp15 with SMTP id p15so33068847wij.0 for ; Thu, 06 Aug 2015 11:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=wwUSzv2lVaj9By6DPFNMRpVJU7UdBa1yxb1FlkgOHZg=; b=ZA423acbx8o4KQXPNKvAhKQbUfBE2r1Yq61mq6vG9FP1ffCx7JxCPEhauObH1pLvEN F+9Fodn0PndoCdfe02Xu0kT1bbN+O+xRf4j5+RC/isoPCwe+UZMeebFbS9mudqSB1ieI 9titykmcsprRuI9HAjdm5gTln+H8zX1E2/jVHnZfl/zk6XNDPUpw83m1w2ouK/9Cz1uq eYLSQaOdZjvAsTCmzDb1CLKLq0qrQwI+XPcIPottAmAc34PcMD51Ktqel8OJzakmDGtw k24o3xWeFZ3428d7Ul8Dlpv4cweuPLzwBq+8H4544D56jrLrb5Bssm8ebwbpy6ScMtw3 9VeQ== X-Received: by 10.194.209.167 with SMTP id mn7mr5867289wjc.64.1438885718667; Thu, 06 Aug 2015 11:28:38 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (84-236-21-48.pool.digikabel.hu. [84.236.21.48]) by smtp.gmail.com with ESMTPSA id i6sm10726509wje.33.2015.08.06.11.28.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Aug 2015 11:28:38 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: qemu-devel@nongnu.org Date: Thu, 6 Aug 2015 20:28:28 +0200 Message-Id: X-Mailer: git-send-email 2.4.5 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::236 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 16/25] paaudio: properly disconnect streams in fini_* X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currently this needs a workaround due to bug #74624 in pulseaudio. Signed-off-by: Kővágó, Zoltán Reviewed-by: Marc-André Lureau --- audio/paaudio.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index e3b8207..2aee22f 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -678,6 +678,25 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) return -1; } +static void qpa_simple_disconnect(PAConnection *c, pa_stream *stream) +{ + int err; + + pa_threaded_mainloop_lock(c->mainloop); + /* wait until actually connects. workaround pa bug #74624 + * https://bugs.freedesktop.org/show_bug.cgi?id=74624 */ + while (pa_stream_get_state(stream) == PA_STREAM_CREATING) { + pa_threaded_mainloop_wait(c->mainloop); + } + + err = pa_stream_disconnect(stream); + if (err != 0) { + dolog("Failed to dissconnect! err=%d\n", err); + } + pa_stream_unref(stream); + pa_threaded_mainloop_unlock(c->mainloop); +} + static void qpa_fini_out (HWVoiceOut *hw) { void *ret; @@ -689,7 +708,7 @@ static void qpa_fini_out (HWVoiceOut *hw) audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); if (pa->stream) { - pa_stream_unref (pa->stream); + qpa_simple_disconnect(pa->g->conn, pa->stream); pa->stream = NULL; } @@ -709,7 +728,7 @@ static void qpa_fini_in (HWVoiceIn *hw) audio_pt_join (&pa->pt, &ret, AUDIO_FUNC); if (pa->stream) { - pa_stream_unref (pa->stream); + qpa_simple_disconnect(pa->g->conn, pa->stream); pa->stream = NULL; }