[pulseaudio-discuss] Question regarding usage of pa_stream_peek() and pa_stream_drop()

nimesh.chanchani at accenture.com nimesh.chanchani at accenture.com
Thu Nov 14 02:40:17 PST 2013


Hi ,

I have a question regarding the usage of pa_stream_peek() and pa_stream_drop().

my usage is :

pa_stream_peek(mStreams[1], &data, &free);
if ( data == NULL && free > 0 )
{
        pa_stream_drop(mStreams[1]);
}
else
{
       fwrite(data, sizeof(uint8_t), free, fpOutput);
        pa_stream_drop(mStreams[1]);
}

The problem is that sometimes i get the data and sometimes not, also when i get the data it is very noisy.

Now, from reading the document, it says :
pa_stream_peek() , returns the bytes read, which may be less than the fragsize.
also, pa_stream_drop() is used to remove the current fragment.

now my question is , since pa_stream_drop is needed to move the buffer forward, so that i read the next , what will happen if I call pa_stream_peek() , which returns partial fragment, and then call pa-stream_drop(), which will drop the fragment. Will this lead to data loss?

Also, if in the above case there is a data loss , what should be the correct sequence of calls?

Regards,
Nimesh



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited.

Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.

______________________________________________________________________________________

www.accenture.com



More information about the pulseaudio-discuss mailing list