From patchwork Sun Aug 18 23:06:53 2019 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: 1148946 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=209.51.188.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="bhm7J5Wm"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46BXrW3g7Pz9s7T for ; Mon, 19 Aug 2019 09:12:11 +1000 (AEST) Received: from localhost ([::1]:43536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzULJ-0002qu-0a for incoming@patchwork.ozlabs.org; Sun, 18 Aug 2019 19:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49733) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzUGT-0006Uk-3r for qemu-devel@nongnu.org; Sun, 18 Aug 2019 19:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzUGS-0005J3-1N for qemu-devel@nongnu.org; Sun, 18 Aug 2019 19:07:08 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45560) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzUGR-0005IX-Rt for qemu-devel@nongnu.org; Sun, 18 Aug 2019 19:07:07 -0400 Received: by mail-wr1-x442.google.com with SMTP id q12so6728990wrj.12 for ; Sun, 18 Aug 2019 16:07:07 -0700 (PDT) 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=rslzC2c2WDwNlJOxHo//ed6lLff8LJfI6lnQMj5SLIg=; b=bhm7J5WmqoaiqOT9MpO/YBlLvJe2+OELuIQxSHhTPuJ/UnOP28hg03rFukTJMpHZMS 9YWtMjmspgdeap3qRuPUyj0WdSvV4M7CCpbKo5Tjgg1uH4LtUPZ+0NuFEzUJAF+v+28v ticIqugalbBHuQuLB5s7V7CYjUFCaIy34b71PTYnDNUGK4YfIryPBIHAQrXhEv/5Gjrj LPeLsn2SqvTpbk0mRvUFtiNpIbh4JNUp6DOd6kbE2gwENAk+SDH9f73QbGlMdgpDNp0i rrlsJ7eLksZtExxu5Dt9BuH66y032i6GIx+O+uetsCmcA6K+1FgO1hYJAqivqwVZQjTq MPiQ== 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=rslzC2c2WDwNlJOxHo//ed6lLff8LJfI6lnQMj5SLIg=; b=V9AU0c5hDR3NeGFfu7JpoNGOZcrQdbVs7gXKv90X1VoNuZCXGpOA6lCvFUfpch25pu eaPpafM00lNUcBP156UOsMawSJ0XlN8sYix12Rkx+iuXqmKIYmNF5XKrUSCS8auNAcao mBeBmAotzvD4Ya+55ra9Jn5QSQ0dNaYyKkQZ17JpFdDSt5smVQ+DM7n1BFNb7trWcYNJ Q4hAtH+Blorg0FO28RYYcNgH/DjhPAEV5roWAYlQuBNweNM/f9gYsbkfmJ7fhe+Tn9eS rDm6+Fa2FpAERGuVf9VBV5xuUdsOYM4tT5bCssxs/CfiEyqZhFpSQ5xY/30Q611Nk/eS HAzg== X-Gm-Message-State: APjAAAVRjH/ruogHIwgdZaDCm2SsLsPVLQs88v8hyoyvJ3P3x6FiTlHJ Qp8I2nP/vN7VHtpSrupjr7PAV74AxUw= X-Google-Smtp-Source: APXvYqwYF2hOooTME+dXctIkL5vuCECTpDypSc3fiEQKeXemYjoSfDA+d4fWycw6MPPkJ8wKyp40iA== X-Received: by 2002:a5d:4cc5:: with SMTP id c5mr21987734wrt.278.1566169626737; Sun, 18 Aug 2019 16:07:06 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-49c9-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:49c9::5]) by smtp.gmail.com with ESMTPSA id c15sm33657152wrb.80.2019.08.18.16.07.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Aug 2019 16:07:06 -0700 (PDT) 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: Mon, 19 Aug 2019 01:06:53 +0200 Message-Id: X-Mailer: git-send-email 2.22.0 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::442 Subject: [Qemu-devel] [PATCH v4 08/14] paaudio: properly disconnect streams in fini_* X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 #247 in pulseaudio. Signed-off-by: Kővágó, Zoltán Reviewed-by: Marc-André Lureau --- audio/paaudio.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index 24d98b344a..1d68173636 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -685,6 +685,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 #247 + * https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/247 + */ + 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 disconnect! err=%d\n", err); + } + pa_stream_unref(stream); + pa_threaded_mainloop_unlock(c->mainloop); +} + static void qpa_fini_out (HWVoiceOut *hw) { void *ret; @@ -696,7 +717,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; } @@ -716,7 +737,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; }