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 A5512EB64DA for ; Sun, 16 Jul 2023 12:36:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 996BADE5; Sun, 16 Jul 2023 14:35:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 996BADE5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689510992; bh=yvtuhWLQ+EExarWsHG2awiTbIVsOuHEaffBfimuWLNo=; h=From:To:In-Reply-To:References:Subject:Date:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=qHqI0CGDuaUnLzUNnj5Dhp77irH/yU3lvOaJZ277YbDvMJkprSH8HAuiDt4/RDiLn Dcvp4uP5Djfi9w4JkP58jbRThv9EUCLtmaVakDsCoTpUvqPv00a50q6jEw5zewiGDT DPalvB2kxOQnI4fV3+ITrewgf6ty+ScyYBi+i1Z4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6AD7BF80494; Sun, 16 Jul 2023 14:34:50 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 40925F8047D; Sun, 16 Jul 2023 14:34:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 75B82F8047D; Sun, 16 Jul 2023 14:33:42 +0200 (CEST) Received: from webhooks-bot.alsa-project.org (vmi242170.contaboserver.net [207.180.221.201]) by alsa1.perex.cz (Postfix) with ESMTP id 1F652F8027B for ; Sun, 16 Jul 2023 14:33:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1F652F8027B MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: GitHub issues - opened To: alsa-devel@alsa-project.org In-Reply-To: <1689510816799805164-webhooks-bot@alsa-project.org> References: <1689510816799805164-webhooks-bot@alsa-project.org> Subject: speaker-test: inconsistent behaviour of --buffer option. Message-Id: <20230716123342.75B82F8047D@alsa1.perex.cz> Date: Sun, 16 Jul 2023 14:33:42 +0200 (CEST) Message-ID-Hash: 7TJIF4DRRJC6MDR7ZMMI5X4H2TC4GKTW X-Message-ID-Hash: 7TJIF4DRRJC6MDR7ZMMI5X4H2TC4GKTW X-MailFrom: github@alsa-project.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: alsa-project/alsa-utils issue #224 was opened from AndrewAmmerlaan: Without specifying the `--buffer` option `speaker-test returns this: ``` andrew@andrew-gentoo-pc ~ % speaker-test -c2 -twav -Dplughw:CARD=PCH,DEV=3 speaker-test 1.2.9 Playback device is plughw:CARD=PCH,DEV=3 Stream parameters are 48000Hz, S16_LE, 2 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 64 to 1048576 Period size range from 32 to 524288 Using max buffer size 1048576 Periods = 4 was set period_size = 262144 was set buffer_size = 1048576 0 - Front Left 1 - Front Right Write error: -77,File descriptor in bad state xrun_recovery failed: -77,File descriptor in bad state Transfer failed: File descriptor in bad state ``` Note that it says `Using max buffer size 1048576`. But now if we try to explicitly specify this maximum buffer size: ``` andrew@andrew-gentoo-pc ~ % speaker-test -c2 -twav -Dplughw:CARD=PCH,DEV=3 --buffer 1048576 speaker-test 1.2.9 Playback device is plughw:CARD=PCH,DEV=3 Stream parameters are 48000Hz, S16_LE, 2 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 64 to 1048576 Period size range from 32 to 524288 Requested buffer time 1000000 us Periods = 4 was set period_size = 12000 was set buffer_size = 48000 0 - Front Left 1 - Front Right Time per period = 2.251287 ``` Note that now we get `Requested buffer time 1000000 us` which is less then what we actually specified. In fact this will happen with any `--buffer` parameter larger then `1000000`: ``` andrew@andrew-gentoo-pc ~ % speaker-test -c2 -twav -Dplughw:CARD=PCH,DEV=3 --buffer 1000001 speaker-test 1.2.9 Playback device is plughw:CARD=PCH,DEV=3 Stream parameters are 48000Hz, S16_LE, 2 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 64 to 1048576 Period size range from 32 to 524288 Requested buffer time 1000000 us Periods = 4 was set period_size = 12000 was set buffer_size = 48000 0 - Front Left 1 - Front Right Time per period = 2.251042 ``` Leading me to believe that despite what `speaker-test` claims, `1000000` is actually the maximum, not `1048576`. Discovered while debugging https://gitlab.freedesktop.org/drm/intel/-/issues/8462 This behaviour of `speaker-test` is confusing though and feels to me like a separate issue. Issue URL : https://github.com/alsa-project/alsa-utils/issues/224 Repository URL: https://github.com/alsa-project/alsa-utils