Skip to content

Commit

Permalink
pulseaudio: Change PaPulseAudio_CheckConnection return values
Browse files Browse the repository at this point in the history
Now PaPulseAudio_CheckConnection return -1 when it waits
something to happen (it's kind of no error nor there is
something to wait) then there is PA_OK which is when
connection is on wire. Then if it returns PA_ERR_ACCESS
which is when ACCESS is denied.
  • Loading branch information
illuusio committed Jan 31, 2024
1 parent e85bea8 commit 7dfd844
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hostapi/pulseaudio/pa_linux_pulseaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extern char *__progname;
/* PulseAudio specific functions */
int PaPulseAudio_CheckConnection( PaPulseAudio_HostApiRepresentation * ptr )
{
int retCode = paNotInitialized;
int retCode = -1;

if ( ptr == NULL )
{
Expand All @@ -88,7 +88,7 @@ int PaPulseAudio_CheckConnection( PaPulseAudio_HostApiRepresentation * ptr )
*/

case PA_CONTEXT_READY:
retCode = paNoError;
retCode = PA_OK;
break;

case PA_CONTEXT_CONNECTING:
Expand All @@ -100,8 +100,8 @@ int PaPulseAudio_CheckConnection( PaPulseAudio_HostApiRepresentation * ptr )
}
else
{
retCode = paUnanticipatedHostError;

retCode = PA_ERR_ACCESS;
switch( state )
{
/* These can be found from
Expand Down Expand Up @@ -615,12 +615,12 @@ PaError PaPulseAudio_Initialize( PaUtilHostApiRepresentation ** hostApi,

result = PaPulseAudio_CheckConnection( pulseaudioHostApi );

if( result != paNotInitialized && result != paNoError )
if( result > PA_OK )
{
goto error;
}

if( result == paNoError )
if( result == PA_OK )
{
ret = 1;
}
Expand Down

0 comments on commit 7dfd844

Please sign in to comment.