Skip to content

Commit

Permalink
Use the drained callback on the playback stream
Browse files Browse the repository at this point in the history
This may be more correct than using the "paused" event.
  • Loading branch information
DemiMarie committed Oct 1, 2023
1 parent d80536b commit 03a5337
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pipewire/qubes-pw-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ static void stream_state_changed_common(void *d, enum pw_stream_state old,
return;
case PW_STREAM_STATE_PAUSED:
pw_log_debug("%s paused", name);
set_stream_state(&impl->stream[playback ? PW_DIRECTION_INPUT : PW_DIRECTION_OUTPUT], false);
if (!playback)
set_stream_state(&impl->stream[playback ? PW_DIRECTION_INPUT : PW_DIRECTION_OUTPUT], false);
break;
case PW_STREAM_STATE_STREAMING:
pw_log_debug("%s streaming", name);
Expand Down Expand Up @@ -820,6 +821,12 @@ static void capture_stream_param_changed(void *data, uint32_t id,
stream_param_changed(data, id, param, PW_DIRECTION_OUTPUT);
}

static void playback_stream_drained(void *data)
{
struct impl *impl = data;
set_stream_state(&impl->stream[PW_DIRECTION_INPUT], false);
}

static const struct pw_stream_events capture_stream_events = {
.version = PW_VERSION_STREAM_EVENTS,
.destroy = capture_stream_destroy,
Expand Down Expand Up @@ -849,7 +856,7 @@ static const struct pw_stream_events playback_stream_events = {
.add_buffer = NULL,
.remove_buffer = NULL,
.process = playback_stream_process,
.drained = NULL,
.drained = playback_stream_drained,
};

static int create_stream(struct impl *impl, enum spa_direction direction)
Expand Down

0 comments on commit 03a5337

Please sign in to comment.