From patchwork Sun Aug 4 17:04:20 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: 1141803 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="EMbEHk6h"; 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 461nQ31FHbz9sDB for ; Mon, 5 Aug 2019 03:07:23 +1000 (AEST) Received: from localhost ([::1]:48880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huJyb-0008Q9-8j for incoming@patchwork.ozlabs.org; Sun, 04 Aug 2019 13:07:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56686) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1huJw4-0002O8-PL for qemu-devel@nongnu.org; Sun, 04 Aug 2019 13:04:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1huJw2-00048N-KD for qemu-devel@nongnu.org; Sun, 04 Aug 2019 13:04:44 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1huJw1-00040h-GX for qemu-devel@nongnu.org; Sun, 04 Aug 2019 13:04:42 -0400 Received: by mail-wm1-x341.google.com with SMTP id f17so70837785wme.2 for ; Sun, 04 Aug 2019 10:04:36 -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=EMbEHk6h6pQNZwGzxGYAtxbS5OwGqmB7zIC6lQTqkNqIGbXv1jlnYU1cNpkuNDN/18 m29tip//zh0qgVM0V/cajWI1knBCAnZ0a8zmd+3VOf49ihcGvr5f83DyJkgVFrs170Gq m1b1Ulj+E2/CT/0xqd0Bim+F/oazvCPG4PjljnvQupIELKxaRhFI2LMzrV1QhDyy09Pj p6KYeVcSe19tLfTGnFCpWLZ6sh8tLpCmSfoXBT0D/VKua46HoFoMNMitFx/gXsxrx9Oy bmqKWkBudatCp7Dur3KvvYqafJNIjv4+7boKg9Du+QO9Tgr5B6VEWBeHkQzUFt+yL74d 5OfQ== 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=eUgu95HlzxML0kWYRdhgfFihT0gpFAFdDeH2sjp0VtYlCur5Bl7FZF1fWmWgxYvvWi cB6VS8QFukprPhzRxPzW5S0OfFYvOghJi2iJJDNLaC1QQ/8kq5JrMWYo9xuaVX0K+zK2 c+/wg+jOHMFcJQw9BcVkVFNcYiBcToVlzd3eVqfSAsrxqrmsVxXrDmkbUdbi3F2Zvpxu cJklZrr5M8eTqWeYkBOagJ2MINlfm2RTBUbzqmbD10mXinliyeDSaNJMRCMy299ZS6E3 JjwFa+u/xRcf0fQ05Fx8B+cD7m4I7SMV1yeiPKB04L56eQC+A0UacMQUUbKFW6PXMnBc QFeA== X-Gm-Message-State: APjAAAVIHliXNSY3AevnOye2/26NN7SY9ai7iUwArJ7v96ga5Tm//6La dRQlHmawOb3LT4BtDrxCoic/uug7IFc= X-Google-Smtp-Source: APXvYqyudTjPiWYkD0+gxZ7Smp2oZ/xvd8PoPP4b8/5c4Tsahce7Sbg+XBtlKhMktnyL3MBI5Ob2yA== X-Received: by 2002:a7b:c195:: with SMTP id y21mr14002063wmi.16.1564938275570; Sun, 04 Aug 2019 10:04:35 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-632c-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:632c::5]) by smtp.gmail.com with ESMTPSA id s10sm104876106wmf.8.2019.08.04.10.04.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Aug 2019 10:04:35 -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: Sun, 4 Aug 2019 19:04:20 +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::341 Subject: [Qemu-devel] [PATCH v3 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; }