From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C43A4C43334 for ; Sat, 25 Jun 2022 11:29:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EF4261749; Sat, 25 Jun 2022 13:29:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF4261749 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1656156592; bh=fv9EZX3Z6khwiWivN3npbr3hcYvxeihWnNw41+qtMc4=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=FODMZyXuLqgE4CiVsn4mAeN421HhcgPIXqUXXvvM6iSh5ZPHW8y0x/aZtHIWyBB0F 7NXuYeHivC13PZ8DhvIvKQnN4r8/+4U0kCasff1sNdtuT96f/MjR4D+vTZrY11KZvh GfjeT+QqKQW69DfhTuZvvJj59GZIf9fvV4FGI+NA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6E016F80132; Sat, 25 Jun 2022 13:29:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 393B7F80162; Sat, 25 Jun 2022 13:28:59 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C76A6F80107 for ; Sat, 25 Jun 2022 13:28:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C76A6F80107 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="2xtw5IUc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DNwCaNTO" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 3C80C3200645; Sat, 25 Jun 2022 07:28:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 25 Jun 2022 07:28:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t= 1656156523; x=1656242923; bh=fv9EZX3Z6khwiWivN3npbr3hcYvxeihWnNw 41+qtMc4=; b=2xtw5IUcbQlGWIrWotJoWX9DseMVsaUWCwAokZRT1XxnxO3Vrff d4zyaR+X2VyZDWcPhD62jw75YybQvSy9pWH/0aRYM96SXRLmCaRfBF8NKFrVZ5lP jE28QJ0GzGEqghPO6yNDiMvHBdiIKxvR1mdVbLvFi58SVXb0lP3p9sx7jqdxN/H1 sR3sqzN6AdAOyBWZAvSYyQ5mxhi1AAdYovTECRdEHrjJkbICUDgquEbax5/rFc+P PVNVijQBuVih6h4YO9W4n7b8rUdKrDiSB84RBmMuv3ef4nFAH8G4TBj1GfvhE+uc q0EZiREfR8KO4c9gJYw6AzW9T2z8qX9QS+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1656156523; x= 1656242923; bh=fv9EZX3Z6khwiWivN3npbr3hcYvxeihWnNw41+qtMc4=; b=D NwCaNTOMiosxIn7PVIS/Lb1yypbiyD6ra7yjVwf8MDPx/L4cyHcsk02EQeHhlaxG 8ZxKmlMp24oYzKfcQLKNyHyqa8H82ALBwm3XPIGBN9IinPnT/odqOX0iEDd5kpve 6z6MZTB9u31FdkBgE+9wXjA9/pImwdPhxVLTegM/Y9EprnQhOEjhIK3tynWHYxWR OxDQAOaO4acnFSuG671PIl6+UF5XXXRENfws5mwdet/I1TmfsFTj4iu/VdndZQNM 02w2H2q0pAdthVBJze1d+oZmKhavD6ei1ovpyPw5DOp9GuWRSUYceYq+RIYgUUb/ exPYA+9O+mvPXyNgfLCqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeguddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfggtggusehttdertd dttddvnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeelgeeuhfdtte dugeeludffgeelhefgiefhheefleellefhffffjedufeeftddvudenucffohhmrghinhep ghhithhhuhgsrdgtohhmpdhfrhgvvgguvghskhhtohhprdhorhhgnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgr khgrmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Jun 2022 07:28:42 -0400 (EDT) Date: Sat, 25 Jun 2022 20:28:39 +0900 From: Takashi Sakamoto To: perex@perex.cz Subject: attach/detach by mixer class implementation of alsa-lib mixer API Message-ID: Mail-Followup-To: perex@perex.cz, alsa-devel@alsa-project.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Cc: alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Hi Jaroslav, Recent years I'm bothered about unexpected abort of pulseaudio and pipewire processes when testing user-defined control element set. They aborts at element removal event. ``` pulseaudio: mixer.c:149: hctl_elem_event_handler: Assertion `bag_empty(bag)' failed. wireplumber: mixer.c:149: hctl_elem_event_handler: Assertion `bag_empty(bag)' failed. ``` Would I ask your opinion about the design of alsa-lib mixer API? As long as I investigate, these programs seem to have careless coding as alsa-lib mixer API application. Both of them attaches an instance of snd_mixer_elem_t to an instance of snd_hctl_elem_t by calling snd_mixer_elem_attach() when detecting element addition, but never detach it even if detecting element removal. In the case, the link list (=bag) of mixer API internal never becomes empty. It has link entries as much as the number of registered mixer classes which attaches snd_mixer_elem_t. Then it hits the assertion. I think the design of alsa-lib mixer API demands mixer class implementation to detach at element removal which attached at element addition. But I have less conviction about it since enough unfamiliar. I'm glad if receiving your opinion about it. I wrote test program for the issued behaviour: - https://gist.github.com/takaswie/8378fe3bc04652d83428694cd7573bc0 For test, please use sample script in alsa-gobject project: - https://github.com/alsa-project/alsa-gobject/blob/master/samples/ctl The patches for pulseaudio/pipewire are prepared: - https://gitlab.freedesktop.org/takaswie/pulseaudio/-/commit/topic/fix-wrong-handling-alsa-ctl-event - https://gitlab.freedesktop.org/takaswie/pipewire/-/commits/topic/fix-wrong-handling-alsa-ctl-event Regards Takashi Sakamoto