@@ -269,19 +269,9 @@ static const char *getAppName(void)
269269 return SDL_GetAppMetadataProperty (SDL_PROP_APP_METADATA_NAME_STRING );
270270}
271271
272- static void ThreadedMainloopSignal (void )
273- {
274- PULSEAUDIO_pa_threaded_mainloop_signal (pulseaudio_threaded_mainloop , 0 ); // alert waiting threads to unblock.
275-
276- // we need to kill any SDL_SetError state; we didn't create this thread
277- // so its SDL TLS slot will leak otherwise, so we do this every time
278- // we're (presumably) losing control of the thread.
279- SDL_CleanupTLS ();
280- }
281-
282272static void OperationStateChangeCallback (pa_operation * o , void * userdata )
283273{
284- ThreadedMainloopSignal ( ); // just signal any waiting code, it can look up the details.
274+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 ); // just signal any waiting code, it can look up the details.
285275}
286276
287277/* This function assume you are holding `mainloop`'s lock. The operation is unref'd in here, assuming
@@ -323,7 +313,7 @@ static void DisconnectFromPulseServer(void)
323313
324314static void PulseContextStateChangeCallback (pa_context * context , void * userdata )
325315{
326- ThreadedMainloopSignal ( ); // just signal any waiting code, it can look up the details.
316+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 ); // just signal any waiting code, it can look up the details.
327317}
328318
329319static bool ConnectToPulseServer (void )
@@ -410,7 +400,7 @@ static void WriteCallback(pa_stream *p, size_t nbytes, void *userdata)
410400 struct SDL_PrivateAudioData * h = (struct SDL_PrivateAudioData * )userdata ;
411401 //SDL_Log("PULSEAUDIO WRITE CALLBACK! nbytes=%u", (unsigned int) nbytes);
412402 h -> bytes_requested += nbytes ;
413- ThreadedMainloopSignal ( );
403+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 );
414404}
415405
416406// This function waits until it is possible to write a full sound buffer
@@ -481,7 +471,7 @@ static Uint8 *PULSEAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
481471static void ReadCallback (pa_stream * p , size_t nbytes , void * userdata )
482472{
483473 //SDL_Log("PULSEAUDIO READ CALLBACK! nbytes=%u", (unsigned int) nbytes);
484- ThreadedMainloopSignal ( ); // the recording code queries what it needs, we just need to signal to end any wait
474+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 ); // the recording code queries what it needs, we just need to signal to end any wait
485475}
486476
487477static bool PULSEAUDIO_WaitRecordingDevice (SDL_AudioDevice * device )
@@ -602,7 +592,7 @@ static void PULSEAUDIO_CloseDevice(SDL_AudioDevice *device)
602592
603593static void PulseStreamStateChangeCallback (pa_stream * stream , void * userdata )
604594{
605- ThreadedMainloopSignal ( ); // just signal any waiting code, it can look up the details.
595+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 ); // just signal any waiting code, it can look up the details.
606596}
607597
608598static bool PULSEAUDIO_OpenDevice (SDL_AudioDevice * device )
@@ -803,7 +793,7 @@ static void SinkInfoCallback(pa_context *c, const pa_sink_info *i, int is_last,
803793 if (i ) {
804794 AddPulseAudioDevice (false, i -> description , i -> name , i -> index , & i -> sample_spec );
805795 }
806- ThreadedMainloopSignal ( );
796+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 );
807797}
808798
809799// This is called when PulseAudio adds a recording ("source") device.
@@ -813,7 +803,7 @@ static void SourceInfoCallback(pa_context *c, const pa_source_info *i, int is_la
813803 if (i && (include_monitors || (i -> monitor_of_sink == PA_INVALID_INDEX ))) {
814804 AddPulseAudioDevice (true, i -> description , i -> name , i -> index , & i -> sample_spec );
815805 }
816- ThreadedMainloopSignal ( );
806+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 );
817807}
818808
819809static void ServerInfoCallback (pa_context * c , const pa_server_info * i , void * data )
@@ -838,7 +828,7 @@ static void ServerInfoCallback(pa_context *c, const pa_server_info *i, void *dat
838828 }
839829 }
840830
841- ThreadedMainloopSignal ( );
831+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 );
842832}
843833
844834static bool FindAudioDeviceByIndex (SDL_AudioDevice * device , void * userdata )
@@ -882,7 +872,7 @@ static void HotplugCallback(pa_context *c, pa_subscription_event_type_t t, uint3
882872 SDL_AudioDeviceDisconnected (SDL_FindPhysicalAudioDeviceByCallback (FindAudioDeviceByIndex , (void * )(uintptr_t )idx ));
883873 }
884874 }
885- ThreadedMainloopSignal ( );
875+ PULSEAUDIO_pa_threaded_mainloop_signal ( pulseaudio_threaded_mainloop , 0 );
886876}
887877
888878static bool CheckDefaultDevice (const bool changed , char * device_path )
0 commit comments