ref: ebe7cc6cf1f6fea3b8b70bebbf9dbeaa32358a82
parent: 45d5ae0b39ece30ecb7804e1e98239e8fe119bfa
author: Jacob Moody <moody@posixcafe.org>
date: Thu Jan 26 13:18:04 EST 2023
devaudio-pipewire: destroy stream on close We were leaking these streams before, which causes pipewire to hang when the user changes the default sink.
--- a/kern/devaudio-pipewire.c
+++ b/kern/devaudio-pipewire.c
@@ -84,17 +84,14 @@
lock(&pwstate.lk);
pwstate.written = 0;
- if(pwstate.init > 0){
- kproc("pipewire main loop", pwproc, pwstate.loop);
- unlock(&pwstate.lk);
- return;
+ if(pwstate.init == 0){
+ pw_init(&argc, (char***)&argv);
+ pwstate.init++;
+ pwstate.loop = pw_main_loop_new(NULL);
+ if(pwstate.loop == NULL)
+ sysfatal("could not create loop");
}
- pwstate.init++;
- pw_init(&argc, (char***)&argv);
- pwstate.loop = pw_main_loop_new(NULL);
- if(pwstate.loop == NULL)
- sysfatal("could not create loop");
pwstate.output = pw_stream_new_simple(
pw_main_loop_get_loop(pwstate.loop),
"drawterm",
@@ -139,6 +136,7 @@
audiodevclose(void)
{
pw_main_loop_quit(pwstate.loop);
+ pw_stream_destroy(pwstate.output);
}
int