From patchwork Wed Jan 16 23:36: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: 10767149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EE8A17FB for ; Wed, 16 Jan 2019 23:51:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DD1D2F676 for ; Wed, 16 Jan 2019 23:51:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C22C2FC22; Wed, 16 Jan 2019 23:51:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 992192F96F for ; Wed, 16 Jan 2019 23:51:51 +0000 (UTC) Received: from localhost ([127.0.0.1]:34713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjuyM-00073F-Um for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Jan 2019 18:51:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjuks-000472-4s for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:37:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjukk-0002uo-3t for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:37:52 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:45493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjukj-0002qw-P7 for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:37:45 -0500 Received: by mail-wr1-x441.google.com with SMTP id t6so8903769wrr.12 for ; Wed, 16 Jan 2019 15:37:44 -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=5vTKSbVynhXcM5xUP1q28wtIQJgz+4P+VLzqi4OziM4=; b=RgErAxYOVfWMQxZPNFVKXMFVrZY8y6mgZpglr7Tv2swFSF/SruT3KXgfb1WgjGW4RW Q2Dlu4guFwFvpzxddIIK2IBoxowQWtUslL4xDQjFev9Fb/UPhCRmEoIPM01XeESCWzIk KqLCuZGYItmqc/hvo62roz29/Agp2BJyZmazp1Cio98OKPj5hUL8i4kFvjxoIUS0ZTFn Yg90+VhFgy3Dgl5d6WbRdoScoktwS3m/MRVqHLqd/C+faQNe9Y/P+VRFkPlFyAfS+2fn RjRYGNy/OJqW185xu2bQsaUoHH1cXtMXzLsIxoncu9dops4DnbTiBBvXHVfDPJDdS/Ws ++Bg== 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=5vTKSbVynhXcM5xUP1q28wtIQJgz+4P+VLzqi4OziM4=; b=JUELHBsxXv/xwGDlwyAbZikHiflZmVxP7eR0t/JWsWcgsq4OplCeMi2bSMD73ny2eM nwmTHuhQjM03rsgcaeDENcOZHs6H6WVvwGlOFwGRbsHzNRstGYh4F/sx1aV0KCJZvT1w nII1cVLlSFiYamC5E7BamMLKQzhM8r8pX8QtDO0uhDGz2c8RYehHOZE5HAr6RViGW1RO KvV5Tecg7U8UtygqaelMu03+kCfW5OF8XxOrI2yyTmoy5s7mag8wSXvwmhopy9JQ/a7r 0xcN7E/2Ysle+Od9xFyIzX5uosQAOP7ilzkD8Kc4r8i4+cZ5Oo/HXyfSlBpJKmEWqVh4 vz0Q== X-Gm-Message-State: AJcUukfj9olUCQqrV3eqETHCO8EtoepgDhYGZfvSqCoh/7Vxi8VY9J8T x4m6g4jEC/86vnDIkkS2Iim83q86BUo= X-Google-Smtp-Source: ALg8bN7TZKPIwD8oT8gMxWf/b8oT0MeL7rAQkmwthTFZ3quBsKHdYBVwPkD2sns9pYdF+xZz2WyThg== X-Received: by 2002:adf:bc02:: with SMTP id s2mr9182249wrg.255.1547681863656; Wed, 16 Jan 2019 15:37:43 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-e4b0-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:e4b0::5]) by smtp.gmail.com with ESMTPSA id s66sm30760437wmf.34.2019.01.16.15.37.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:37:43 -0800 (PST) From: " =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= " X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Thu, 17 Jan 2019 00:36:53 +0100 Message-Id: <0b2e43a405816f04fd3e603a263fdf901a42e900.1547681517.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::441 Subject: [Qemu-devel] [PATCH v3 20/50] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 108d3158a6..428c848863 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; }