From patchwork Sun Dec 23 20:51:58 2018 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: 1018096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="laVMAF6u"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43NFJc5Cklz9sDr for ; Mon, 24 Dec 2018 08:05:51 +1100 (AEDT) Received: from localhost ([127.0.0.1]:59746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbAwW-0000dJ-6J for incoming@patchwork.ozlabs.org; Sun, 23 Dec 2018 16:05:48 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbAk0-0007s5-1E for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:52:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbAjy-0002Yl-VX for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:52:51 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:34914) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbAjy-0002Rc-NL for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:52:50 -0500 Received: by mail-wr1-x444.google.com with SMTP id 96so10114969wrb.2 for ; Sun, 23 Dec 2018 12:52:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S9Z96Jun/qXlVlruSUttW+xrZVG697H3Ng16fR66cQY=; b=laVMAF6uFQfojHaSDJtMzG/4lBOceN3WC7rVTS0KTQUn+57dUNTkxuGZM7kjcJ3E3U BI/ws336GNDVSVaZQWx9+dkyS5KZREHbYfEIcET2t2sEyvl+/QlRwjyev/Ru/BjyTJ+2 xUDTYUE2tA22t3C4m6Vo19qLcExUOWx22fhTWYkZGFHrh8+GHUAld4B0m6X1cyLALflU tlks/TQ2GECBOAosBAPoah0ufCqAeV10ywlBr1pNgjFtG3YAkI15xDfDUEFq5+5atiDx VSun3o994gC+P2pe/vIK5IZZXtLD7JdCQC8bxpy0CQm8moH4k32RwuUdT6NEPwn3xpcL vOfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S9Z96Jun/qXlVlruSUttW+xrZVG697H3Ng16fR66cQY=; b=abeaJ0/rprcK4ZKDeXQl80jVT3amnou/i0Y1H4rE6bIXCY1K4Y/p2loEM4LWyC7wK5 1YUScQSO1Esbh5g4gVKF7t0Aq79O0e0q98eNMNIbYnENohk67k1YnRzW9/OmZ/xI4zxx t3fyXccqQcsF/Sd1V7sbD/M0Pm0egjfpnSblk2RJFtoztJhtLzfXJM3MuCvqR3PgHQxf mE6J/hZADuTLiqF6gvogmK/GIuogRWR5qWpVLcqy2hblUwfG06g1WSyWCkris0ufQ6+2 GJHvY6deYWnTCExNuz3ul9ONWE0smez26k3G56CiMFysLWNLJoBa7kvEZZ09OrR4ykDj EF6g== X-Gm-Message-State: AJcUukfunDe00OMTS1FujC5C+ugD/j/V0ChbXoSWSirbd7+aXjHFS7SQ GcPBcITjRO5qjTsH4/O1xBZ84VAhCik= X-Google-Smtp-Source: ALg8bN7OIK/KhLlHbped3fItPJIBVKsmHkHCWV/7x+cPyQnTta64ErXUTHu7WdKGFXJV3b8VGdC+Eg== X-Received: by 2002:adf:9382:: with SMTP id 2mr9449376wrp.269.1545598368490; Sun, 23 Dec 2018 12:52:48 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-24a3-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:24a3::5]) by smtp.gmail.com with ESMTPSA id g198sm25456920wmd.23.2018.12.23.12.52.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Dec 2018 12:52:48 -0800 (PST) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Sun, 23 Dec 2018 21:51:58 +0100 Message-Id: <97534e3bc9bd0df88c76193de6cf0530c8210c5f.1545598229.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v2 22/52] paaudio: properly disconnect streams in fini_* X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Currently this needs a workaround due to bug #74624 in pulseaudio. Reviewed-by: Marc-André Lureau Signed-off-by: Kővágó, Zoltán --- audio/paaudio.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index 21ffbf7f6e..fa867a8065 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -680,6 +680,27 @@ 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; @@ -691,7 +712,7 @@ static void qpa_fini_out (HWVoiceOut *hw) audio_pt_join(&pa->pt, &ret, __func__); if (pa->stream) { - pa_stream_unref (pa->stream); + qpa_simple_disconnect(pa->g->conn, pa->stream); pa->stream = NULL; } @@ -711,7 +732,7 @@ static void qpa_fini_in (HWVoiceIn *hw) audio_pt_join(&pa->pt, &ret, __func__); if (pa->stream) { - pa_stream_unref (pa->stream); + qpa_simple_disconnect(pa->g->conn, pa->stream); pa->stream = NULL; }