<div dir="ltr"><div><div><div><div><div><div>Hi,<br><br></div>I am using PulseAudio api to implement a scenario which synchronize an input stream with  an output stream. Synchronize means that whenever input data is available the same number of frames should be set for writing in the output.<br><br></div>In order to achieve that I use two separate streams one for record and the other for playback. In the record call back I check the writable size and if it is big enough I write the data otherwise I reject the packet. This causes some distortion in the output especially when latency is small.<br><br></div>Trying to overcome this problem I stopped checking for writable data. I use pa_stream_begin_write instead before the pa_stream_write to allocated the desired data size. This approach seems to work very well even for very small latency, even when the reported writable size is zero.<br><br></div>My question is, if the approach above is safe and what is the actual representation of the number returned from pa_stream_writable_size method?<br><br></div>Thanks,<br></div>Alex<br></div>