[client] audio/pw: drop redundant flushing state

We do not stop the audio device until after the internal buffer has already
been flushed, so this state does nothing useful.
This commit is contained in:
Chris Spencer 2022-01-24 20:52:27 +00:00 committed by Geoffrey McRae
parent d93510e9f2
commit 8580978321

View File

@ -33,7 +33,6 @@ typedef enum
{
STREAM_STATE_INACTIVE,
STREAM_STATE_ACTIVE,
STREAM_STATE_FLUSHING,
STREAM_STATE_DRAINING,
STREAM_STATE_RESTARTING
}
@ -109,14 +108,6 @@ static void pipewire_onPlaybackProcess(void * userdata)
frames = pw.playback.pullFn(dst, frames);
if (!frames)
{
if (pw.playback.state == STREAM_STATE_FLUSHING)
{
pw_thread_loop_lock(pw.thread);
pw_stream_flush(pw.playback.stream, true);
pw.playback.state = STREAM_STATE_DRAINING;
pw_thread_loop_unlock(pw.thread);
}
sbuf->datas[0].chunk->size = 0;
pw_stream_queue_buffer(pw.playback.stream, pbuf);
return;
@ -299,12 +290,6 @@ static bool pipewire_playbackStart(int framesBuffered)
}
break;
case STREAM_STATE_FLUSHING:
// We were preparing to stop; just carry on as if nothing happened
pw.playback.state = STREAM_STATE_ACTIVE;
start = true;
break;
case STREAM_STATE_DRAINING:
// We are in the middle of draining the PipeWire buffers; we will need
// to reactivate the stream once this has completed
@ -332,7 +317,8 @@ static void pipewire_playbackStop(void)
switch (pw.playback.state)
{
case STREAM_STATE_ACTIVE:
pw.playback.state = STREAM_STATE_FLUSHING;
pw_stream_flush(pw.playback.stream, true);
pw.playback.state = STREAM_STATE_DRAINING;
break;
case STREAM_STATE_RESTARTING: