[alsa-devel] [Alsa-user] regarding setting of fragment size in usbaudio driver

Bill Unruh unruh at physics.ubc.ca
Mon Dec 13 11:05:31 CET 2010


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 at 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 at 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 at physics.ubc.ca
Canada V6T 1Z1     |      and Gravity       |  www.theory.physics.ubc.ca/


More information about the Alsa-devel mailing list