Skip to content

Commit

Permalink
Disconnect stream on target destroy
Browse files Browse the repository at this point in the history
Reduces some resource not available errors and allows stream to be re-connected later

TODO: Figure out why resource not available errors occur
  • Loading branch information
dimtpap committed Aug 22, 2023
1 parent 0c48b47 commit dfe5267
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pipewire-audio-capture-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ static void node_destroy_cb(void *data)
{
struct target_node *n = data;

struct obs_pw_audio_capture_device *pwac = n->pwac;
if (n->serial == pwac->connected_serial) {
if (pw_stream_get_state(pwac->pw.audio.stream, NULL) != PW_STREAM_STATE_UNCONNECTED) {
pw_stream_disconnect(pwac->pw.audio.stream);
}
pwac->connected_serial = SPA_ID_INVALID;
}

spa_hook_remove(&n->node_listener);

bfree((void *)n->friendly_name);
Expand Down

0 comments on commit dfe5267

Please sign in to comment.