Commit f532964f authored by Max Kellermann's avatar Max Kellermann

output/pulse: add wrapper for pa_threaded_mainloop_signal()

parent efea609d
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
void OnStreamWrite(size_t nbytes); void OnStreamWrite(size_t nbytes);
void OnStreamSuccess() { void OnStreamSuccess() {
pa_threaded_mainloop_signal(mainloop, 0); Signal();
} }
gcc_const gcc_const
...@@ -136,6 +136,10 @@ private: ...@@ -136,6 +136,10 @@ private:
*/ */
void DeleteContext(); void DeleteContext();
void Signal() {
pa_threaded_mainloop_signal(mainloop, 0);
}
/** /**
* Check if the context is (already) connected, and waits if * Check if the context is (already) connected, and waits if
* not. If the context has been disconnected, retry to * not. If the context has been disconnected, retry to
...@@ -299,7 +303,7 @@ PulseOutput::OnContextStateChanged(pa_context_state_t new_state) ...@@ -299,7 +303,7 @@ PulseOutput::OnContextStateChanged(pa_context_state_t new_state)
if (mixer != nullptr) if (mixer != nullptr)
pulse_mixer_on_connect(*mixer, context); pulse_mixer_on_connect(*mixer, context);
pa_threaded_mainloop_signal(mainloop, 0); Signal();
break; break;
case PA_CONTEXT_TERMINATED: case PA_CONTEXT_TERMINATED:
...@@ -309,7 +313,7 @@ PulseOutput::OnContextStateChanged(pa_context_state_t new_state) ...@@ -309,7 +313,7 @@ PulseOutput::OnContextStateChanged(pa_context_state_t new_state)
/* the caller thread might be waiting for these /* the caller thread might be waiting for these
states */ states */
pa_threaded_mainloop_signal(mainloop, 0); Signal();
break; break;
case PA_CONTEXT_UNCONNECTED: case PA_CONTEXT_UNCONNECTED:
...@@ -549,7 +553,7 @@ PulseOutput::OnStreamSuspended(gcc_unused pa_stream *_stream) ...@@ -549,7 +553,7 @@ PulseOutput::OnStreamSuspended(gcc_unused pa_stream *_stream)
/* wake up the main loop to break out of the loop in /* wake up the main loop to break out of the loop in
pulse_output_play() */ pulse_output_play() */
pa_threaded_mainloop_signal(mainloop, 0); Signal();
} }
static void static void
...@@ -573,7 +577,7 @@ PulseOutput::OnStreamStateChanged(pa_stream *_stream, ...@@ -573,7 +577,7 @@ PulseOutput::OnStreamStateChanged(pa_stream *_stream,
if (mixer != nullptr) if (mixer != nullptr)
pulse_mixer_on_change(*mixer, context, _stream); pulse_mixer_on_change(*mixer, context, _stream);
pa_threaded_mainloop_signal(mainloop, 0); Signal();
break; break;
case PA_STREAM_FAILED: case PA_STREAM_FAILED:
...@@ -581,7 +585,7 @@ PulseOutput::OnStreamStateChanged(pa_stream *_stream, ...@@ -581,7 +585,7 @@ PulseOutput::OnStreamStateChanged(pa_stream *_stream,
if (mixer != nullptr) if (mixer != nullptr)
pulse_mixer_on_disconnect(*mixer); pulse_mixer_on_disconnect(*mixer);
pa_threaded_mainloop_signal(mainloop, 0); Signal();
break; break;
case PA_STREAM_UNCONNECTED: case PA_STREAM_UNCONNECTED:
...@@ -604,7 +608,7 @@ PulseOutput::OnStreamWrite(size_t nbytes) ...@@ -604,7 +608,7 @@ PulseOutput::OnStreamWrite(size_t nbytes)
assert(mainloop != nullptr); assert(mainloop != nullptr);
writable = nbytes; writable = nbytes;
pa_threaded_mainloop_signal(mainloop, 0); Signal();
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment