alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Ralf Beck <musical_snake@gmx.de>, alsa-devel@alsa-project.org
Subject: Re: (no subject)
Date: Thu, 13 Jun 2019 10:51:07 -0500	[thread overview]
Message-ID: <a00b46af-30c6-fba5-096b-62d88f66ae37@linux.intel.com> (raw)
In-Reply-To: <trinity-bf4e0eb4-e575-4dfc-9315-bc322b7b7f19-1560405271802@3c-app-gmx-bs72>

On 6/13/19 12:54 AM, Ralf Beck wrote:
> 
> Jaroslav Kysela wrote:
>> I just don't think that the mmap transfer mode is the culprit of the problems.
>> The problem is that the PCI cards off-loads the DMA transfers completely
>> without the extra framing required for those serial hardware interfaces which
>> are handled in the audio driver and the other kernel stacks (USB etc.).
> 
> The source of all evil is the ring buffer.
> It prevents all devices that require packet headers (Firewire/network based solutions) or that
> use a variable amount of frames per packet (all asynchronous devices, especially asynchronous USB ISO endpoints)
> from mapping their data directly into userspas memory without ever touching the audio data in it.
> 
> While this doesn't hurt performance to much with devices that offer only a few channels,
> it has a massive effect on network based devices with possibly hundreds of channels of which only
> a small number is used (e.g. record enabled) at a time.
> 
> The ringbuffer should be replaced by a buffer that holds the packets and a descriptor for how to find the data in it. Btw, alsa uses something similar already for the mmap handling.
> 
> The descriptor should consist of
> x periods, containing y chunks with a max size, containing z channels, each of the channel described by a start address and step value within that chunk.

You're assuming a reliable network where not a single packet is missing. 
I can bet that if you start adding support for packet-based audio some 
folks are going to want to support timestamps and missing packets, which 
would throw a large size monkey-wrench in your ideas of time reporting 
below.
Also note that you could rely on the compressed API to deal with packets 
as an interface between your applications and your hardware - even if 
the actual data is PCM. It's still based on a ring buffer but it doesn't 
have the built-in bytes-to-time relationship that the ALSA PCM API 
relies on.

> Examples:
> PCI device; 2 periods, 1 chunks per period, max size 64 frames per chunk, 2 channels per chunk
> USB device: 2 periods, 8 chunks (microframes) max size 8 frames (if at 44.1/48kHz), 2 channels per chunk,
> Same for Firewire, AVB (each chunk possibly containing several AVB streams, i.e. ethernet packets), etc.
> 
> Period elapsed => the number of chunks forming a period have been received
> 
> snd_pcm_avail(_update) => return the sum of actual frames of the period
> 
> snd_pcm_mmap_commit => return the descriptor for one chunk, the number of frames of the chunk and a channel map for the chunk. The reason for the latter is that on ethernet based devices (AVB) there is bo guarantee that streams of different endpoints are received in the same order (but in the same interval window).
> Alsa clients should then loop until they have processed all frames thar have been reported by snd_pcm_avail (instead of a period size number of frames).
> 
> Ah, and AM824 raw audio format, used by firewire and AVB, should by added to the list of audio formats, so conversion can be done in userspace.
> 
> Ralf
> 
> 
>   
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

  reply	other threads:[~2019-06-13 15:51 UTC|newest]

Thread overview: 179+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13  5:54 (no subject) Ralf Beck
2019-06-13 15:51 ` Pierre-Louis Bossart [this message]
2019-06-13 19:19 ` Jaroslav Kysela
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08  0:03 Giuliano Zannetti - ART S.p.A.
2019-04-28  8:52 (No Subject) rodomar705
2018-01-24 12:00 (no subject) twischer
2017-07-19 15:25 [PATCH 000/102] Convert drivers to explicit reset API Philipp Zabel
2017-07-20 20:36 ` (no subject) Heiko Stuebner
2017-03-09 10:32 Felix Bruns
2017-01-13 10:46 [PATCH v3 4/8] x86: stop exporting msr-index.h to userland Nicolas Dichtel
2017-01-09 11:33 ` [PATCH v2 0/7] uapi: export all headers under uapi directories Arnd Bergmann
2017-01-13 10:46   ` [PATCH v3 0/8] " Nicolas Dichtel
2017-01-13 15:43     ` (no subject) David Howells
2016-09-20 18:12 xerofoify
2015-06-30 10:50 E.Richiardone
2014-11-14 16:40 Angelo Dureghello
2013-08-05  8:38 Chih-Chung Chang
     [not found] <s5hmx1526mg.wl%tiwai@suse.de>
2012-09-06  6:02 ` Markus Trippelsdorf
2012-09-06  6:33   ` (no subject) Daniel Mack
2012-09-06  6:48     ` Takashi Iwai
2011-09-08 10:20 A S
2011-09-08 11:03 ` Clemens Ladisch
2011-03-01 14:02 Javier Martin
2010-09-08  7:25 asim khan
2010-04-13 14:38 Sascha Hauer
2009-09-22 11:46 Delusion's Master
2009-08-11 21:02 Chaithrika U S
2009-08-11 11:36 ` chaithrika
2009-05-30  1:23 James Gardiner
2009-05-30  7:01 ` Takashi Iwai
2009-03-27  6:56 xrun on sdp340 with small buffers Jarkko Nikula
2009-03-27 13:32 ` (no subject) Jarkko Nikula
2009-03-27 16:31   ` Mark Brown
2008-11-24 13:09 Nitin Mahajan
2008-11-20 13:10 Nitin Mahajan
     [not found] <1226996302-10234-1-git-send-email-cooloney@kernel.org>
2008-11-18 11:45 ` Mark Brown
2008-11-17 23:24 Fernando Moro
2008-11-11  2:43 Yang, Libin
2008-11-11  8:17 ` Takashi Iwai
2008-10-14 12:16 Philippe CARRIERE
2008-10-13 10:51 Philippe CARRIERE
2008-10-13 14:28 ` Takashi Iwai
2008-10-14  9:54   ` Karsten Wiese
2008-10-14 10:41     ` Philippe Carriere
2008-10-14 11:29       ` Karsten Wiese
2009-01-27  0:16       ` Karsten Wiese
2009-01-29  8:35         ` Philippe Carriere
2008-04-03  8:47 郝舜
2008-04-03  8:56 ` Clemens Ladisch
     [not found] <EC2127EFF67248B9B1F7F34B45F74E55@Main>
     [not found] ` <B84B1606A0264FA18CBE236F84E6CE96@Main>
2008-02-21 10:51   ` Ответы для Linux Format Serge A. Suchkov
2008-02-21 12:13     ` (no subject) Serge A. Suchkov
2007-09-06  5:57 Krzysztof Helt
2007-09-06 13:14 ` Takashi Iwai
2007-03-09 12:28 Sutton O. Javelin
2007-03-09  6:48 Empty V. Crock
2007-03-08 16:58 Giggler S. Defeatist
2007-03-08  0:13 Arjuna H. Settlement
2007-03-07  8:58 Cutlasses M. Greek
2007-03-07  2:38 Flickering E. Sharps
2007-03-06 19:35 Rational K. Haggard
2007-03-06 15:57 Redeeming T. Angus
2007-02-28  0:11 Orient K. Underpinnings
2007-02-27  8:42 Depreciates F. Sum
2007-02-27  4:07 Whispers F. Charlie
2007-02-20  1:21 Dr.Friedrick Conway
2007-02-17 11:14 Dr.Hank Miles
2007-02-17  1:20 Dr.Aaron Barrera
2007-02-15 19:58 Nautilus S. Womb
2007-02-13 22:04 Dear Sir Madam
2007-02-01  6:55 COM CYCL
2007-01-30 19:51 Karsten Wiese
2007-01-31  9:22 ` Takashi Iwai
2007-01-23  1:12 Establishes S. Adoption
2007-01-21 15:47 Maisie T. Deathblow
2007-01-12  3:00 Barracuda K. Bobbi
2007-01-10 10:53 Acid P. Hank
2007-01-10  3:03 Timezone D. Authenticity
2007-01-06  4:15 Lintel E. Late
2007-01-05 20:41 Princeton F. Aligns
2007-01-05 10:44 Wot V. Armband
     [not found] <JAMB7R$1E04724C7A33DA4578A20ADF8AC469B0@libero.it>
2006-12-21 15:03 ` Clemens Ladisch
2006-12-16 14:17 tardo2002
2006-12-18  9:53 ` Clemens Ladisch
2006-12-04  7:01 miki
2006-11-26  3:25 Glenn K. Transporting
2006-11-24 22:41 Generality O. Lifeblood
2006-11-24 10:44 Proponent V. Stepbrother
2006-11-24  4:07 Scrounger D. Aboded
2006-11-24  1:17 Profanation R. Meandering
2006-11-23 18:13 Groins O. Animation
2006-11-22  1:27 Variance P. Whirled
2006-11-20  8:18 Tamil E. Turnoffs
2006-11-15 10:46 Doctor
2006-11-13 14:19 Doctor
2006-11-12 10:26 Rectums C. Palate
2006-11-12  6:26 Antonio Sampayo
2006-10-31 19:37 Isabel Decker
2006-10-30 10:40 Doctor
2006-10-30  2:45 Doctor
2006-10-28 22:25 Garbs H. Pecan
2006-10-28 19:35 ATA YAZILIM A.Þ.
2006-10-27 14:44 Skelhorn.RJC
2006-10-20 16:55 (Was Re: [Alsa-user] Poorly supported HDA intel) Ricardo Cerqueira
2006-10-20 17:16 ` Ricardo Cerqueira
2006-10-24 19:08   ` (no subject) Thierry Vignaud
2006-10-19  3:24 misato
2006-10-18  6:57 James Templeton
2006-10-09 23:13 albox
2006-10-07 12:41 yuki
2006-10-04  1:18 miyuki
2006-09-16 12:15 yukihana
2006-09-11  2:58 yukaridayo
2006-06-27  3:26 Paulo Cordeiro
2006-06-10  5:03 Rita Bruce
2006-05-05  1:37 OcHe
2006-05-06 23:25 ` Eric Shattow
2006-05-10 17:26 ` Clemens Ladisch
2006-03-19 13:05 汇嘉宏
2006-01-10 13:24 Daniel Mack
2006-01-10 17:07 ` Takashi Iwai
2006-01-10 19:12   ` Clemens Ladisch
2006-01-11 11:29     ` Daniel Mack
2005-12-07 10:44 Ramani Karuppiah
2005-09-21 18:35 Ryan Olejnik
2005-05-21  1:25 haf
2005-05-20 10:39 haf
2005-03-16 12:38 Eric
2005-03-16 13:22 ` Takashi Iwai
     [not found]   ` <1806.132.168.64.149.1110980407.squirrel@132.168.64.149>
2005-03-16 13:43     ` Takashi Iwai
     [not found]       ` <1908.132.168.64.149.1110981336.squirrel@132.168.64.149>
2005-03-16 13:59         ` Takashi Iwai
2004-12-28 11:42 Geoffrey Kendall
2004-12-28  8:31 Daniel L. Finch
2004-12-28  7:58 Sung S. Marshall
2004-12-25 23:11 Gil F. Phelps
2004-12-25  9:06 Juanita Britt
2004-12-23  8:33 Jake Link
2004-12-13 11:08 Steven
2004-12-13  0:46 Irma M. Harris
2004-12-04  7:02 Jamal Lambert
2004-12-03  7:12 Marsha Olson
2004-12-02 17:34 Vickie
2004-12-01  0:04 Mason Sinclair
2004-11-30 22:49 Lena M. Ochoa
2004-11-30 18:27 Janine Rowe
2004-11-30  5:35 Jill
2004-11-28 10:24 Tonia Castillo
2004-11-28  7:07 Sasha Peoples
2004-11-25 11:29 刘小姐
2004-11-06  2:30 Julie
2004-10-26 16:28 Katherine S. Burris
2004-10-25  1:00 Matt
2004-10-23 13:28 Ashley
2004-10-22 13:42 Desmond Murdock
2004-10-21  3:11 Tiffany Bloom
2004-10-20  8:26 Rui Nuno Capela
2004-10-20  8:56 ` Jaroslav Kysela
     [not found] <200410031405.i93YolTw000749@www3.gmail.com>
2004-10-14 19:23 ` Dane May
     [not found] <200410031464.i93YboTw008147@www6.gmail.com>
2004-10-14 19:23 ` Alyson Holley
2004-10-12 13:11 news globelife
2004-10-09 13:36 Adolph Tipton
2004-10-09  3:55 Robert Ritter
2004-10-08 20:11 Francesca B. Mendoza
2004-10-05 18:20 そふとうぇあ
2004-10-05  8:15 Genaro P. Tapia
2004-09-21 14:57 rte news
2004-09-19  7:02 Jill
2004-09-13 22:08 Inez
2004-09-06  1:16 Julie
2004-09-03  6:14 Ben
2004-07-05  5:45 Bo Henriksen
2003-11-11  0:07 Itay Ben-Yaacov
2003-10-16 20:02 Mark62756
2003-07-16  1:55 Eliot Blennerhassett
2003-07-16 11:40 ` Takashi Iwai
2003-06-26  0:40 Eliot Blennerhassett
2003-06-26  2:46 ` Fred Gleason
2003-04-24 15:21 Max Drechsler
2003-04-28 13:18 ` Takashi Iwai
2002-12-08 23:53 Henry Walpool
2002-08-02 14:48 Friedrich.Ewaldt
2002-07-20  6:57 double speed (ADAT), and hw params ordering Jaroslav Kysela
2002-07-20 19:20 ` (no subject) Fernando Pablo Lopez-Lezcano
2002-07-20 23:04   ` Abramo Bagnara
2002-07-05 16:51 Thorsten Haas
2002-04-01 12:10 optin_travel
2002-04-01  7:53 Patrick Shirkey
2002-03-31 22:22 optin_travel
2002-03-31 13:12 catsman
2002-04-01  4:17 ` Juan Linietsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a00b46af-30c6-fba5-096b-62d88f66ae37@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=musical_snake@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).