mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-28 10:52:02 +00:00
[client] pipewire: make it possible to stop from the process callback
This commit is contained in:
@@ -134,10 +134,8 @@ static void pipewire_onPlaybackProcess(void * userdata)
|
|||||||
|
|
||||||
static void pipewire_onPlaybackDrained(void * userdata)
|
static void pipewire_onPlaybackDrained(void * userdata)
|
||||||
{
|
{
|
||||||
pw_thread_loop_lock(pw.thread);
|
|
||||||
pw_stream_set_active(pw.playback.stream, false);
|
pw_stream_set_active(pw.playback.stream, false);
|
||||||
pw.playback.state = STREAM_STATE_INACTIVE;
|
pw.playback.state = STREAM_STATE_INACTIVE;
|
||||||
pw_thread_loop_unlock(pw.thread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct Option pipewire_options[] =
|
static struct Option pipewire_options[] =
|
||||||
@@ -361,10 +359,9 @@ static void pipewire_playbackStart(void)
|
|||||||
if (!pw.playback.stream)
|
if (!pw.playback.stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
pw_thread_loop_lock(pw.thread);
|
||||||
if (pw.playback.state != STREAM_STATE_ACTIVE)
|
if (pw.playback.state != STREAM_STATE_ACTIVE)
|
||||||
{
|
{
|
||||||
pw_thread_loop_lock(pw.thread);
|
|
||||||
|
|
||||||
switch (pw.playback.state)
|
switch (pw.playback.state)
|
||||||
{
|
{
|
||||||
case STREAM_STATE_INACTIVE:
|
case STREAM_STATE_INACTIVE:
|
||||||
@@ -380,19 +377,32 @@ static void pipewire_playbackStart(void)
|
|||||||
default:
|
default:
|
||||||
DEBUG_UNREACHABLE();
|
DEBUG_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_thread_loop_unlock(pw.thread);
|
|
||||||
}
|
}
|
||||||
|
pw_thread_loop_unlock(pw.thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pipewire_playbackStop(void)
|
static void pipewire_playbackStop(void)
|
||||||
{
|
{
|
||||||
if (pw.playback.state != STREAM_STATE_ACTIVE)
|
const bool inThread = pw_thread_loop_in_thread(pw.thread);
|
||||||
return;
|
if (!inThread)
|
||||||
|
|
||||||
pw_thread_loop_lock(pw.thread);
|
pw_thread_loop_lock(pw.thread);
|
||||||
|
|
||||||
|
if (pw.playback.state != STREAM_STATE_ACTIVE)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
if (inThread)
|
||||||
|
{
|
||||||
|
pw_stream_set_active(pw.playback.stream, false);
|
||||||
|
pw.playback.state = STREAM_STATE_INACTIVE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
pw_stream_flush(pw.playback.stream, true);
|
pw_stream_flush(pw.playback.stream, true);
|
||||||
pw.playback.state = STREAM_STATE_DRAINING;
|
pw.playback.state = STREAM_STATE_DRAINING;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (!inThread)
|
||||||
pw_thread_loop_unlock(pw.thread);
|
pw_thread_loop_unlock(pw.thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user