-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pcm: clarify documentation of poll descriptor usage #370
Conversation
I also have an interest in this: I would would like to see clarification of the permitted pfd array that may be passed to |
It is not allowed to change the returned Which plugins do have bad interpretation? |
To clarify: The |
The ordering is visible in the |
The pipewire alsa plugin initially interpreted the Wrt the |
This point arose quite a long time ago now, when trying to debug an issue using the BlueALSA plugin (https://github.com/arkq/bluez-alsa) with MPD (https://github.com/MusicPlayerDaemon/MPD). It turned out that MPD breaks up the pfd array in order to use |
Actually, those descriptors won't change after |
I don't quite understand why you say "recommend". Shouldn't the documentation clearly state what the user must do for correct operation? So either it is valid to fetch the descriptors once for a pcm device (then it makes no sense to recommend anything else) or you need to update them whenever the hardware configuration changes, but then it is not a recommendation but a requirement for correct behavior. |
Hm, I suppose what you mean is "when you don't follow the recommendation, it may or may not work correctly for your hardware/plugin", so it is just your manner of speaking and I misunderstood that. Though I believe it is sufficient that the API simply describes its safe correct usage, as it is obvious that any deviation from it may run into issues. In my eyes a "recommendation" can be interpreted as not really binding when it comes to being clear about what is a bug on the user's side vs a bug in the driver/plugin. |
It is a recommendation for possible future extensions. The current requirement is to fetch file descriptors at any time from the valid PCM handle. They won't be changed in the current plugins (but I cannot speak for the plugins outside ALSA repos). It was most probably the reason why we don't write much about this when the APIs were designed. We should not probably complicate things so much - if we have users or requirements in future, we can probably update APIs. So drop this idea (for prepare state). |
Agreed. If you decide to rework the APIs in the future, I think it is better to add new methods and keep the old the same to keep backwards compatibility and not break old application code. Anyway, for now just documenting correct usage should be fine. |
The revents function description should be extended that the caller should KEEP the file descriptor order in array as returned poll_descriptors as discussed. |
Just to confirm, is it just the order that must be kept for the array? Say, |
No order, count or index changes are allowed in the descriptor array. |
This is based on my understanding of the intended behavior, the test/pcm.c example code, as well as the github pull request discussion (alsa-project#370). There needs to be more clarifiaction regarding the exact semantics of the value of the revents output parameter of snd_pcm_poll_descriptors_revents, since there are events that do not necessarily correspond to POLLIN or POLLOUT (such as period events), but I believe this is a lot less obvious and needs confirmation first.
This is based on my understanding of the intended behavior and the test/pcm.c example code.
There needs to be more clarifiaction regarding the exact semantics of the value of the revents output parameter of
snd_pcm_poll_descriptors_revents, since there are events that do not necessarily correspond to POLLIN or POLLOUT (such as period events), but I believe this is a lot less obvious and needs confirmation first.