Comment 25 for bug 485488

Revision history for this message
David Henningsson (diwic) wrote :

Well, here is something to try out. I'll fix something more appropriate (git-send-email, debdiff, etc) in the next few days, right now I'm a bit to tired for the formalities. But I hope these three fixes should improve the situation.

1)
+ /* Prevent accidental overrun of the fake ringbuffer */
+ if (size >= pcm->buffer_attr.tlength)
+ size = pcm->buffer_attr.tlength-1;

This cured a hang I could sometimes reproduce while recovering from an xrun.

2)
+ writebytes = size * pcm->frame_size;
+ ret = pa_stream_write(pcm->stream, buf, writebytes, NULL, 0, 0);
+ pcm->last_size -= writebytes;

This updates the hw_ptr variable correctly, which fixed some continous xruns for me as well as reduced CPU usage.

3)
+ /* Reset faked buffer */
+ pcm->last_size = 0;
+ pcm->ptr = 0;
+ update_ptr(pcm);

Before prepare is called the ioplug interface resets its pointers, so we should do the same. No real difference in experience from this one, it just seems reasonable.