[alsa-devel] Options for u_audio.c behavior when UAC2 host is disconnected/idle
Hi,
I would like to discuss options to make the g_audio device more usable. Currently if the USB UAC2 function does not supply/consume any audio data (USB disconnected or the host side is not using the UAC2 gadget, the g_audio devices (both capture and playback) are waiting, leading eventually to an error. This makes using the feature rather inconvenient.
Possible options (certainly more are available)
1) The alsa devices will be openable at any time and when the UAC2 is not producing/consuming, the alsa devices will be generating zeros/dropping samples. Dropping samples would be similar to the snd-aloop behavior.
2) Opening the alsa devices will fail when the UAC2 is not actively running, and the pcm stream will be closed when UAC2 stops being active. This is similar to how SPDIF receivers are coded in alsa drivers - if change in the incoming SPDIF stream is detected (no samples, different sample rate), the pcm stream is closed https://github.com/torvalds/linux/blob/master/sound/i2c/other/ak4117.c#L504 It is up to the application to handle the error/close.
The behavior could be configurable via some params, if needed.
Thanks a lot for any suggestions and recommendations.
Best regards,
Pavel.
P.S.: I posted the same message to linux-usb mailing list, with no response. I think this issue is more alsa-related, hence re-posting to alsa-devel. Or should I keep both mailing lists posted? Thanks for understanding.
participants (1)
-
Pavel Hofman