* regarding setting of fragment size in usbaudio driver @ 2010-12-11 9:16 Amit Nagal 2010-12-13 9:04 ` Clemens Ladisch 0 siblings, 1 reply; 7+ messages in thread From: Amit Nagal @ 2010-12-11 9:16 UTC (permalink / raw) To: alsa-user, alsa-devel; +Cc: Takashi Iwai, Clemens Ladisch, helloin.amit Hi , i am using a OSS based usbaudio application for usb audio streaming . my usb audio device is capture only device . i want to set the fragment size of usbaudio alsa driver to reduce latency problem coming in my application . currently even if my application reads 4k data from userspace , i observed driver will buffer for 100 ms data ( period size data )= 16 k at 44100 frquency and after driver reads 16k data , read call will return with 4k data . so read() call remains blocked for 100ms which is causing some latency problem . i used SNDCTL_DSP_SETFRAGMENT ioctl , but still driver behaviour to buffer 100ms data remained same . how driver's fragment size in driver can be set to some less value in OSS based application . Can some patch be implemented in kernel space to do that .? Thanx & Regards Amit Nagal ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regarding setting of fragment size in usbaudio driver 2010-12-11 9:16 regarding setting of fragment size in usbaudio driver Amit Nagal @ 2010-12-13 9:04 ` Clemens Ladisch 2010-12-13 9:56 ` Amit Nagal [not found] ` <27661_1292234220_1292234220_AANLkTi=S732=Wj572Th860PpBYE0fkJ97JH2CwitZ4ah@mail.gmail.com> 0 siblings, 2 replies; 7+ messages in thread From: Clemens Ladisch @ 2010-12-13 9:04 UTC (permalink / raw) To: Amit Nagal; +Cc: alsa-user, alsa-devel Amit Nagal wrote: > i am using a OSS based usbaudio application for usb audio streaming . > > my usb audio device is capture only device . > > i want to set the fragment size of usbaudio alsa driver to reduce > latency problem coming in my application . > > currently even if my application reads 4k data from userspace , i > observed driver will buffer for 100 ms data ( period size data )= 16 k > at 44100 frquency > > and after driver reads 16k data , read call will return with 4k data > . so read() call remains blocked for 100ms which is causing some > latency problem . There is no extra buffer in the driver. There seems to be something wrong with your algorithm. Does recording with the arecord tool work? Regards, Clemens ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regarding setting of fragment size in usbaudio driver 2010-12-13 9:04 ` Clemens Ladisch @ 2010-12-13 9:56 ` Amit Nagal 2010-12-13 13:38 ` Clemens Ladisch [not found] ` <27661_1292234220_1292234220_AANLkTi=S732=Wj572Th860PpBYE0fkJ97JH2CwitZ4ah@mail.gmail.com> 1 sibling, 1 reply; 7+ messages in thread From: Amit Nagal @ 2010-12-13 9:56 UTC (permalink / raw) To: Clemens Ladisch; +Cc: alsa-user, alsa-devel Hi , Thanx for the reply . Actually on my embedded target , i am not using arecord , but reading from (/dev/dsp0) capture data . i have 2 question : i used SNDCTL_DSP_GETBLKSIZE ioctl to find the fragment size of driver . i found it to be 16k . 1) now if the application reads 4k data from userspace , read call will remain blocked for audio driver's fragment size usb data read ( 16k) or app_request_size(4k) ? 2)time taken for read(4k) = time_taken(fragment size read ) or time_taken(app_request_size=4k) ? thanx & regards amit nagal On Mon, Dec 13, 2010 at 6:04 PM, Clemens Ladisch <clemens@ladisch.de> wrote: > Amit Nagal wrote: >> i am using a OSS based usbaudio application for usb audio streaming . >> >> my usb audio device is capture only device . >> >> i want to set the fragment size of usbaudio alsa driver to reduce >> latency problem coming in my application . >> >> currently even if my application reads 4k data from userspace , i >> observed driver will buffer for 100 ms data ( period size data )= 16 k >> at 44100 frquency >> >> and after driver reads 16k data , read call will return with 4k data >> . so read() call remains blocked for 100ms which is causing some >> latency problem . > > There is no extra buffer in the driver. > There seems to be something wrong with your algorithm. > > Does recording with the arecord tool work? > > > Regards, > Clemens > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regarding setting of fragment size in usbaudio driver 2010-12-13 9:56 ` Amit Nagal @ 2010-12-13 13:38 ` Clemens Ladisch 2010-12-13 14:11 ` Amit Nagal 0 siblings, 1 reply; 7+ messages in thread From: Clemens Ladisch @ 2010-12-13 13:38 UTC (permalink / raw) To: Amit Nagal; +Cc: alsa-user, alsa-devel (please don't top-post) Amit Nagal wrote: > i used SNDCTL_DSP_GETBLKSIZE ioctl to find the fragment size of driver > . i found it to be 16k . > > 1) now if the application reads 4k data from userspace , read call > will remain blocked for audio driver's fragment size usb data read ( > 16k) > or app_request_size(4k) ? If, when read() is called, there is enough data in the buffer, it will return that data and return immediately. Otherwise, it will wait for the hardware to reach the next period boundary (in OSS: fragment boundary) and try again. If you want to have shorter waits, use lower fragment sizes. Regards, Clemens ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regarding setting of fragment size in usbaudio driver 2010-12-13 13:38 ` Clemens Ladisch @ 2010-12-13 14:11 ` Amit Nagal 2010-12-14 16:23 ` Clemens Ladisch 0 siblings, 1 reply; 7+ messages in thread From: Amit Nagal @ 2010-12-13 14:11 UTC (permalink / raw) To: Clemens Ladisch; +Cc: alsa-user, alsa-devel > (please don't top-post) > Extremely sorry for that . will take care reagarding this from now on . > If, when read() is called, there is enough data in the buffer, it will > return that data and return immediately. Otherwise, it will wait for > the hardware to reach the next period boundary (in OSS: fragment > boundary) and try again. > > If you want to have shorter waits, use lower fragment sizes. yes , setting of lower fragment size is my requirement at the moment in OSS application . i tried to use SNDCTL_DSP_SETFRAGMENT ioctl to set lower fragment size . but audio driver uses default fragment size only and not the fragment size desired by application . Is it possible to change fragment size in kernel space ? Thanx & Regards Amit Nagal ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regarding setting of fragment size in usbaudio driver 2010-12-13 14:11 ` Amit Nagal @ 2010-12-14 16:23 ` Clemens Ladisch 0 siblings, 0 replies; 7+ messages in thread From: Clemens Ladisch @ 2010-12-14 16:23 UTC (permalink / raw) To: Amit Nagal; +Cc: alsa-user, alsa-devel Amit Nagal wrote: > > If you want to have shorter waits, use lower fragment sizes. > > yes , setting of lower fragment size is my requirement at the moment > in OSS application . > i tried to use SNDCTL_DSP_SETFRAGMENT ioctl to set lower fragment size . In theory, this should work. > but audio driver uses default fragment size only and not the fragment > size desired by application . Does it return an error? If yes, try moving this call before some other parameter setting ioctls. Regards, Clemens ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <27661_1292234220_1292234220_AANLkTi=S732=Wj572Th860PpBYE0fkJ97JH2CwitZ4ah@mail.gmail.com>]
* Re: [Alsa-user] regarding setting of fragment size in usbaudio driver [not found] ` <27661_1292234220_1292234220_AANLkTi=S732=Wj572Th860PpBYE0fkJ97JH2CwitZ4ah@mail.gmail.com> @ 2010-12-13 10:05 ` Bill Unruh 0 siblings, 0 replies; 7+ messages in thread From: Bill Unruh @ 2010-12-13 10:05 UTC (permalink / raw) To: Amit Nagal; +Cc: alsa-user, alsa-devel, Clemens Ladisch [-- Attachment #1: Type: TEXT/PLAIN, Size: 3049 bytes --] On Mon, 13 Dec 2010, Amit Nagal wrote: > Hi , > > Thanx for the reply . > > Actually on my embedded target , i am not using arecord , but reading > from (/dev/dsp0) capture data . He asked you if arecord works, not whether you are using it. Why are you using the OSS emulation in alsa, rather than using the native alsa? That adds an extra layer and more code. > > i have 2 question : > > i used SNDCTL_DSP_GETBLKSIZE ioctl to find the fragment size of driver > . i found it to be 16k . > > 1) now if the application reads 4k data from userspace , read call > will remain blocked for audio driver's fragment size usb data read ( > 16k) > or app_request_size(4k) ? So read in all 16K into your buffer. But you do not say how your application reads that 4k in? Why do you not publish the fragment of you code that you use so people can see what y ou do. As I understand OSS, the driver reads the usb and puts the output into a buffer. YOur call to the oss system, then reads from that buffer and delivers it to you. That should not block, unless there is nothing in the buffer (ie you forgot to tell the driver to start reading the sound card). > > 2)time taken for read(4k) = time_taken(fragment size read ) or > time_taken(app_request_size=4k) ? > > thanx & regards > amit nagal > > > On Mon, Dec 13, 2010 at 6:04 PM, Clemens Ladisch <clemens@ladisch.de> wrote: >> Amit Nagal wrote: >>> i am using a OSS based usbaudio application for usb audio streaming . >>> >>> my usb audio device is capture only device . >>> >>> i want to set the fragment size of usbaudio alsa driver to reduce >>> latency problem coming in my application . >>> >>> currently even if my application reads 4k data from userspace , i >>> observed driver will buffer for 100 ms data ( period size data )= 16 k >>> at 44100 frquency >>> >>> and after driver reads 16k data , read call will return with 4k data >>> . so read() call remains blocked for 100ms which is causing some >>> latency problem . >> >> There is no extra buffer in the driver. >> There seems to be something wrong with your algorithm. >> >> Does recording with the arecord tool work? >> >> >> Regards, >> Clemens >> > > ------------------------------------------------------------------------------ > Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, > new data types, scalar functions, improved concurrency, built-in packages, > OCI, SQL*Plus, data movement tools, best practices and more. > http://p.sf.net/sfu/oracle-sfdev2dev > _______________________________________________ > Alsa-user mailing list > Alsa-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/alsa-user > -- William G. Unruh | Canadian Institute for| Tel: +1(604)822-3273 Physics&Astronomy | Advanced Research | Fax: +1(604)822-5324 UBC, Vancouver,BC | Program in Cosmology | unruh@physics.ubc.ca Canada V6T 1Z1 | and Gravity | www.theory.physics.ubc.ca/ [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-12-14 16:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-11 9:16 regarding setting of fragment size in usbaudio driver Amit Nagal
2010-12-13 9:04 ` Clemens Ladisch
2010-12-13 9:56 ` Amit Nagal
2010-12-13 13:38 ` Clemens Ladisch
2010-12-13 14:11 ` Amit Nagal
2010-12-14 16:23 ` Clemens Ladisch
[not found] ` <27661_1292234220_1292234220_AANLkTi=S732=Wj572Th860PpBYE0fkJ97JH2CwitZ4ah@mail.gmail.com>
2010-12-13 10:05 ` [Alsa-user] " Bill Unruh
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.