Re: Measuring Device Throughput - MMAP vs. RW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 9, 2019 at 7:44 PM Takashi Iwai <tiwai@xxxxxxx> wrote:

> > The mmap fluctuations seem to be fixed by using increases in hardware
> > pointer pcm->hw.ptr values instead of frames variable. Please do these
> > values wrap up or do they grow  to max long? Still contiguous after 10
> > minutes of running.
>
> Could you elaborate the requirement?  The description isn't clear to
> me.
>

I need to slave EP OUT of asynchronous USB-audio gadget  (i.e. device) to
another (output) soundcard in the system so that adaptive resampling in the
chain "USB gadget -> processing -> output soundcard" is avoided.  For that
I need to measure average throughput to/from alsa hw:X devices, to gather
data for the feedback endpoint implemented by the gadget driver.  I do not
have any control over configuration of the devices, the feedback must run
independently of the rest of the chain, of the applications used.

In snd_pcm_hw_mmap_commit I subtract the advancement of pcm->hw.ptr from
value approx. 10 seconds ago, divided by passed nanosecs measured by
clock_gettime(CLOCK_MONOTONIC). For that I need the pcm->hw.ptr either to
be monotonic, or I just reset the averaging if a non-monotony is detected
(hw pointer in previous (n-1) call of snd_pcm_hw_mmap_commit was higher
than  current value).

For better precision, would it make sense to update the pcm->hw.ptr with
snd_pcm_avail call in that method? It may not be even possible in that
method due to some locking, I really do not know. But my precision
requirements are not very strict since I can average over long time
(minutes) for the feedback (the clock difference is usually very small).


>
> You should be able to skip XRUN check by changing the stop_threshold.
> Setting it to the boundary size essentially means skipping XRUN
> checks.
>

Actually if  xruns could be detected by discontinuity of the hw pointer, I
would not need any other method.


> In anyway, I put Pierre to Cc, as he's done some works in the past for
> the accurate position reporting on HD-audio and USB-audio devices.
> He can give a better hint in this regard.


Thanks a lot, I very much appreciate your help. I do not know these
low-level alsa details. But I will gladly learn.

Pavel.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux