[pulseaudio-discuss] alsa sink latency - how to account for startup delay
Raymond Yau
superquad.vortex2 at gmail.com
Sat Apr 16 03:08:41 UTC 2016
>>
>>
>> >
>> >> do loopback module assume sink is not running when it start source
capture?
>> >>
>> > Sink and source are started independently. Source data is discarded
until the sink-input has
>> > called pop() the first time.
>>
>> But you cannot skip more than 9ms source data since you need 1ms( or
25ms fragment time when not using timer schedule mode) to capture
>>
>> If you are using usb as source and hda as sink, hda fifo trigger dma
transfer whenever the fifo fill level is less than fifo threshold, you need
to fill 256 bytes at first write to avoid fifo underrun
>>
>>
> Yes, if the source takes too long to start up, there will be an an
underrun.
> But as I said, I fill the memblockq with silence to the full requested
> end-to-end latency before starting source or sink. This is usually
sufficient
> to avoid underruns at startup.
> Additionally the new loopback code contains an underrun protection,
> if the configured end-to-end latency is too small. After 3 underruns it
> will increase the target latency by 5 ms until no underruns occur.
>
>
Your method require source and sink suppport same rate and format, how
about usb webcam mic support only 16000Hz and hda sink which do not support
16000Hz?
How about those fixed latency sound cards which does not support latency
adjust (e.g. granularity is period time 25ms) pcm pointer only increase by
period size when interrupt occur
ar 30 21:46:01 pico1 pulseaudio[11846]: [alsa-sink-USB Audio] alsa-sink.c:
Starting playback.
Mar 30 21:46:01 pico1 pulseaudio[11846]: [pulseaudio]
module-suspend-on-idle.c: Sink
alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00.analog-stereo becomes
idle, timeout in 5 seconds.
Mar 30 21:46:01 pico1 pulseaudio[11846]: [alsa-sink-USB Audio] ratelimit.c:
322 events suppressed
Mar 30 21:46:01 pico1 pulseaudio[11846]: [alsa-sink-USB Audio] alsa-sink.c:
Cutting sleep time for the initial iterations by half.
Mar 30 21:46:01 pico1 pulseaudio[11846]: [alsa-sink-USB Audio] alsa-sink.c:
Cutting sleep time for the initial iterations by half.
why 322 events suppressed ?
0 21:46:01 pico1 pulseaudio[11846]: [pulseaudio] module-loopback.c: Minimum
possible latency: 2,50
Mar 30 21:46:01 pico1 pulseaudio[11846]: [alsa-sink-USB Audio] alsa-sink.c:
Cutting sleep time for the initial iterations by half.
Mar 30 21:46:01 pico1 pulseaudio[11846]: [alsa-sink-USB Audio] alsa-sink.c:
Cutting sleep time for the initial iterations by half.
will module loopback stop when user specify latency less than minimum
possible ?
How do you know there is no underrun when stop threshold is set to boundary?
How do you recover underrun when source capture less data than sink
playback? Do loopback inject some data?
The lowest latency is hardware dependent, will the loopback module
recalcuate after user switch sink or source ?
Neither alsa avail nor delay increase like a straight line, the main
problem is you don't know the process time for your to skip and copy data
from input to output,
how can the latency be accurate?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20160416/ff3a7006/attachment.html>
More information about the pulseaudio-discuss
mailing list