-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
ao_pipewire: add support for device selection #9734
Conversation
ec24c51
to
4b86bba
Compare
The random freezes are fixed now. This PR should be ready for review and testing now. The hotplug points require changes to the larger AO logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to say it seems like a pretty convoluted mechanism just enumerate fundamental metadata. There's no imperative way to get it?
Anyway, It worked in my basic testing and does what it's supposed to do.
Just out of curiosity, what kind of changes would that be? I'm not doubting you, but pipewire code looks basically exactly like how wayland code looks so it's a bit surprising to hear that a higher level of abstraction is needed to handle hotplugging instead of it just living in |
|
@Dudemanguy The problem is in for (int n = 0; audio_out_drivers[n]; n++) {
const struct ao_driver *d = audio_out_drivers[n];
if (d == &audio_out_null)
break; // don't add unsafe/special entries
struct ao *ao = ao_alloc(true, hp->global, hp->wakeup_cb, hp->wakeup_ctx,
(char *)d->name);
if (!ao)
continue;
if (ao->driver->hotplug_init) {
if (!hp->ao && ao->driver->hotplug_init(ao) >= 0)
hp->ao = ao; // keep this one
if (hp->ao && hp->ao->driver == d)
get_devices(hp->ao, list);
} else {
get_devices(ao, list);
}
if (ao != hp->ao)
talloc_free(ao);
} This will make sure that only the first driver with a if (!hp->ao && ao->driver->hotplug_init(ao) >= 0)
hp->ao = ao; // keep this one Edit: seems to be intentional: struct ao_hotplug {
// A single AO instance is used to listen to hotplug events. It wouldn't
// make much sense to allow multiple AO drivers; all sane platforms have
// a single such audio API.
// This is _not_ the same AO instance as used for playing audio.
struct ao *ao;
} |
@t-8ch: Would it be better to just wait for the pipewire developer to come up with some way for clients to detect if pipewire is driving the audio? |
Yeah, we can wait with the full hotplug functionality for when the pipewire so comes before pulse.
Then this PR should be in it's final state.
|
I'm fine with with merging as it is. Adding hot plug support on top is incremental, and there is value in what exists here right now, |
Our allocated buffers should be big enough, but add some errorhandling just in case.
@t-8ch Do you want to squash and I'll merge it, or do you want to wait for the detection work in pipewire? |
@philipl I think it should be two commits. The cleanup commit is not actually related to the device list feature. |
Open points:
process()
callback is not fired by Pipewire, so the playback stays frozen. Needs to be investigated.