[pulseaudio-discuss] pa stream write routine return values

Arun Raghavan arun at arunraghavan.net
Fri May 27 07:24:59 UTC 2016



On Fri, 20 May 2016, at 03:00 AM, John Promersberger wrote:
> Ok, I guess the information that I want is directly accessible.  retval
> simply tells me that I need to get the error from my context instance?
> 
> 
> ________________________________
> From: pulseaudio-discuss
> <pulseaudio-discuss-bounces at lists.freedesktop.org> on behalf of John
> Promersberger <jpromersberger at hotmail.com>
> Sent: Thursday, May 19, 2016 3:25 PM
> To: pulseaudio-discuss at lists.freedesktop.org
> Subject: [pulseaudio-discuss] pa stream write routine return values
> 
> 
> Everyone in this listing has been absolutely amazing in their willingness
> to help.
> 
> 
> So I wrote my program that plays various wav files on multiple streams
> upon request along with several samples.  Works really well so far, but
> I'm trying to handle the last couple of errors. Very infrequently,
> meaning it happened once after 5 days, my stream write callback calls
> 
> 
> int retval = pa_stream_write(s, base + offset, writeSize, NULL, 0,
> PA_SEEK_RELATIVE);
> 
> if (retval)
> 
>     sprintf(tempstr,"GDS Pulse Audio: ERROR: Stream write returned a
>     value of %d", retval);
> 
> 
> and retval will report a value of -15.
> 
> 
> I have modified it to call pa_strerror, but I will likely have to run it
> for nearly a week hoping that it will repeat.
> 
> 
> I expected a return value from the pa_error_code enum, not a negative
> number.
> 
> 
> Can someone
> 
>   1. give me some insight into this retval
> 
>   2. determine it's meaning (or point me to some documentation of
>   meanings, I'm willing to fish)

Just take a look at the enum -- 15 is PA_ERR_BADSTATE.

  https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/def.h#n455

You can see why that return value might happen at:

  https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/stream.c#n1475

There are two conditions in the initial checks where BADSTATE is
returned.

-- Arun


More information about the pulseaudio-discuss mailing list