Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1029388lqo; Thu, 9 May 2024 02:37:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUwZOJ/5p0SPQev4dX5OVUmcp9Cax8awHINwCMiGXooRC4xxINZLvrL+i29KLshErnQc94My9i7Me6EeIX3qCJ1CCfcQwvWqSabcWkarA== X-Google-Smtp-Source: AGHT+IEM0SCYBnoyp516XuLHFPIP9K4NjT333xBYXXdSlpAdxm8wCeWhZaeH9dNWeaIHF64ZBzGH X-Received: by 2002:a05:620a:4d16:b0:790:a3a7:7cab with SMTP id af79cd13be357-792b27bee24mr557545585a.39.1715247445385; Thu, 09 May 2024 02:37:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715247445; cv=pass; d=google.com; s=arc-20160816; b=JAO/EPooLnAtAKmEZ/Cr+c+9xdn9N238Jrh3WUveq3vpmhAAfULJ5C7zkEO8bmJC0M eXk/q1Fz/E8Lq3Q8g1SNEI832OYKgde9Lti2TjWsYAMmunp6Cek79Xv5BSFVTxTvSWY8 xw2iKqwvnw+sFw/AoEunf4Y9wf39FfK1JGGVm7JyqyhwgyRdi+IyB0psHNylu36eAEN6 4MkjZrgaXH3/QmJkueLlFDH/gq0rwhekPWNemH77Mx/DNxK7RmaIWoPnvAhIkoNElSjA fcpm6blccjl9arhzIQgLyTpev5D1TZsgGtEpD356xBkaeK+BBos7nE+TKyfi2ohWFyXf Oj3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=icJF1CnJVBJloJSGMiGDeLLdcHlpsMMYY04rY+Lcxgw=; fh=ARlpHBejTw5AiwILcl+P1Wg0Yea416ZowtllnyMdT+w=; b=RL5JUO/iZmThpop6TQqUJYwtTuUijWhL9S3C9P4GrZ5150DQdQBVKb6XExiilqelx4 u5mk3Rzmh52/M6IRzeV2PU+wiSFDv367c0APwkrl+S4D0ZyCBb9FlCuzB2FxcHDPYwWC UVA0+oyAUvYOU+7qv8MKw3nwBayghGXF+6ltl6HLQ2OhAuh1cbXKuevp2V8d7s1n02cv bA6nFBY1m6p5TFYG3IXmphj/CsKZkcUIRH/XnZxpoxvPFe5Pbuzp8b404+A47BEiZnd4 SYQEK9pKnKDAp0fNEm2l1JXhlDeLRbRgRzFhXGVN4rryFNbTpTeDCuBgA41WUTSTLYvJ PIEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MT9cEtew; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-174356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf336c13si90700785a.420.2024.05.09.02.37.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 02:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MT9cEtew; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-174356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1BFDB1C21F05 for ; Thu, 9 May 2024 09:37:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB3E014B07D; Thu, 9 May 2024 09:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MT9cEtew" Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5712814AD33; Thu, 9 May 2024 09:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715247411; cv=none; b=c0mGJlaQKI5D0JiAMhTD0WuqeXwi42LyBXtuMjWMHP4YN2pQFRL3FqKCGinsJj7qhbAuUO18/uCdXlpwrB+ikkhMK3AkQV84UyVAR1qHeD1zQe7u3osicTI9yXUlXOQTgIBxRwm5JzUUxnp8TtFS4n4jX+RQE43SLICoEqEpvx4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715247411; c=relaxed/simple; bh=cy7CWmqg8JaRX86mPUU3bC3ulyypV5pK2pkW2V9kha8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=fZM8hNPEysbzejFH4cfW5nx7HV06JG+jmGIzCt2P/UY24wquFbVahtFRr+hGqRYqEtCXS9Od59q69RU7Lv/qq3+zIrd0kLsN8ySq9DwArWEhm3ZYVeOIAjsCGsDHBtUn1NQwS/avVllrqBelMfR2yYGRP5eDetP3COR7ZLZC10s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MT9cEtew; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-36c947ff642so2955895ab.2; Thu, 09 May 2024 02:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715247409; x=1715852209; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=icJF1CnJVBJloJSGMiGDeLLdcHlpsMMYY04rY+Lcxgw=; b=MT9cEtewURBApcPQ6S9pcYmWLbMv2bMDcoLQ+RiM0ybXQqi/nKvu+3fv6IQ/oK872q 91mcPUFu2JTQBf1Ch19FzBSABCO4ywu96SRATyRdzPkjppA4NPR8CLex6D92qjqVycsY g49f+Dd8BWa4bQwyfh3NtadYNxI1y5WZ3ma8NlIgJ4oUDSXV/tzUSEQ39rDVu/WW0blN OFa+NqCyG7ICqGWBz+1/+J1Oqh0ARjHdBn7FOIau+YM0AmtZU/jjhsZJz5YQ8scOMGvS WBip9JwS2vICR5xrtr8HzQisFZ0Pe9FPDEV3sGZiy8j+b9QGznSgiLR3szxjGV+Ygi9k vNew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715247409; x=1715852209; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=icJF1CnJVBJloJSGMiGDeLLdcHlpsMMYY04rY+Lcxgw=; b=ulbLy46E9eP7GyS1/3ky4UDMUcpRzvDy+Rp8spstQUoiRO6wUGw3A/JaL+1spjDDec J4CAwbp9mpU2jE8MefKFXXtw0lahQdDAQqU8KQEme97Djh0g1lueOUYx5xHnHrL4VFXH ewOxUJy4+XX2LnBJw9ziz+6w41j7Wn4XnwCFdvI8iVI2GY34VoF2gk1U7cs2PkuydiYV Irev0H4nH6ETQaLX/Ozr+44Lf+yTMBVb/FVlrtt52Cd967n6ZIGf8+BorRkfa47i9y/9 CRyIuZ6qOZzK5Xs3GzRpx9CIilMVns0lIwaQndjeXtte64P7O16Aa8h9HLmeXp2kuad/ /IZg== X-Forwarded-Encrypted: i=1; AJvYcCVrIuL1fjvcpL3seGTzAeSUtK7YFiF8pv/UxopcFOE6h7EwnfNkYNpESInyS5yt0uoz3LucdeyMvds4e8tqMCWSqsC48KbxHShzWzFJCru92lPSs7q7xHZAef9nj+4AzQIkOmGjoe8iMG0= X-Gm-Message-State: AOJu0YyCDp2RL2aui3OJ9tA54pPMd6+YwJokVxhwLG5hsqTnUOYq/vYU mYfzq8cJwUdIzWywL67cESTosE3TdwjfFhqIv+e8T54tBzqVUiS3zEaBTmvMOQbghHjcEzMhGJR KaJfaQ1zf8Cc2oZnIOPN5C1tDSmk= X-Received: by 2002:a05:6e02:168a:b0:36a:3c07:9caf with SMTP id e9e14a558f8ab-36caed59232mr53903665ab.30.1715247409368; Thu, 09 May 2024 02:36:49 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1710834674-3285-1-git-send-email-shengjiu.wang@nxp.com> <20240430082112.jrovosb6lgblgpfg@basti-XPS-13-9310> <20240430172752.20ffcd56@sal.lan> <87sez0k661.wl-tiwai@suse.de> <20240502095956.0a8c5b26@sal.lan> <20240502102643.4ee7f6c2@sal.lan> <20240503094225.47fe4836@sal.lan> <22d94c69-7e9f-4aba-ae71-50cc2e5dd8ab@xs4all.nl> <51408e79-646d-4d23-bc5b-cd173d363327@linux.intel.com> In-Reply-To: <51408e79-646d-4d23-bc5b-cd173d363327@linux.intel.com> From: Shengjiu Wang Date: Thu, 9 May 2024 17:36:38 +0800 Message-ID: Subject: Re: [PATCH v15 00/16] Add audio support in v4l2 framework To: =?UTF-8?B?QW1hZGV1c3ogU8WCYXdpxYRza2k=?= Cc: Hans Verkuil , Mauro Carvalho Chehab , Mark Brown , Takashi Iwai , Sebastian Fricke , Shengjiu Wang , sakari.ailus@iki.fi, tfiga@chromium.org, m.szyprowski@samsung.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 8, 2024 at 4:14=E2=80=AFPM Amadeusz S=C5=82awi=C5=84ski wrote: > > On 5/8/2024 10:00 AM, Hans Verkuil wrote: > > On 06/05/2024 10:49, Shengjiu Wang wrote: > >> On Fri, May 3, 2024 at 4:42=E2=80=AFPM Mauro Carvalho Chehab wrote: > >>> > >>> Em Fri, 3 May 2024 10:47:19 +0900 > >>> Mark Brown escreveu: > >>> > >>>> On Thu, May 02, 2024 at 10:26:43AM +0100, Mauro Carvalho Chehab wrot= e: > >>>>> Mauro Carvalho Chehab escreveu: > >>>> > >>>>>> There are still time control associated with it, as audio and vide= o > >>>>>> needs to be in sync. This is done by controlling the buffers size > >>>>>> and could be fine-tuned by checking when the buffer transfer is do= ne. > >>>> > >>>> ... > >>>> > >>>>> Just complementing: on media, we do this per video buffer (or > >>>>> per half video buffer). A typical use case on cameras is to have > >>>>> buffers transferred 30 times per second, if the video was streamed > >>>>> at 30 frames per second. > >>>> > >>>> IIRC some big use case for this hardware was transcoding so there wa= s a > >>>> desire to just go at whatever rate the hardware could support as the= re > >>>> is no interactive user consuming the output as it is generated. > >>> > >>> Indeed, codecs could be used to just do transcoding, but I would > >>> expect it to be a border use case. See, as the chipsets implementing > >>> codecs are typically the ones used on mobiles, I would expect that > >>> the major use cases to be to watch audio and video and to participate > >>> on audio/video conferences. > >>> > >>> Going further, the codec API may end supporting not only transcoding > >>> (which is something that CPU can usually handle without too much > >>> processing) but also audio processing that may require more > >>> complex algorithms - even deep learning ones - like background noise > >>> removal, echo detection/removal, volume auto-gain, audio enhancement > >>> and such. > >>> > >>> On other words, the typical use cases will either have input > >>> or output being a physical hardware (microphone or speaker). > >>> > >> > >> All, thanks for spending time to discuss, it seems we go back to > >> the start point of this topic again. > >> > >> Our main request is that there is a hardware sample rate converter > >> on the chip, so users can use it in user space as a component like > >> software sample rate converter. It mostly may run as a gstreamer plugi= n. > >> so it is a memory to memory component. > >> > >> I didn't find such API in ALSA for such purpose, the best option for t= his > >> in the kernel is the V4L2 memory to memory framework I found. > >> As Hans said it is well designed for memory to memory. > >> > >> And I think audio is one of 'media'. As I can see that part of Radio > >> function is in ALSA, part of Radio function is in V4L2. part of HDMI > >> function is in DRM, part of HDMI function is in ALSA... > >> So using V4L2 for audio is not new from this point of view. > >> > >> Even now I still think V4L2 is the best option, but it looks like ther= e > >> are a lot of rejects. If develop a new ALSA-mem2mem, it is also > >> a duplication of code (bigger duplication that just add audio support > >> in V4L2 I think). > > > > After reading this thread I still believe that the mem2mem framework is > > a reasonable option, unless someone can come up with a method that is > > easy to implement in the alsa subsystem. From what I can tell from this > > discussion no such method exists. > > > > Hi, > > my main question would be how is mem2mem use case different from > loopback exposing playback and capture frontends in user space with DSP > (or other piece of HW) in the middle? > I think loopback has a timing control, user need to feed data to playback = at a fixed time and get data from capture at a fixed time. Otherwise there is xrun in playback and capture. mem2mem case: there is no such timing control, user feeds data to it then it generates output, if user doesn't feed data, there is no xrun. but mem2mem is just one of the components in the playback or capture pipeline, overall there is time control for whole pipeline, Best regards Shengjiu Wang > Amadeusz >