output/pulse: add wrapper for pa_threaded_mainloop_signal()

This commit is contained in:
Max Kellermann 2015-01-04 19:42:15 +01:00
parent efea609dc3
commit f532964fde
1 changed files with 11 additions and 7 deletions

View File

@ -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:
*/ */
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)
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)
/* 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)
/* 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,
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,
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)
assert(mainloop != nullptr); assert(mainloop != nullptr);
writable = nbytes; writable = nbytes;
pa_threaded_mainloop_signal(mainloop, 0); Signal();
} }
static void static void