[vlc-devel] [RFC] directsound: fix for #8860

Ludovic Fauvet etix at videolan.org
Sat Jul 20 01:50:48 CEST 2013


DISCLAIMER: I'm not in any way a DirectSound expert this is why I did this RFC.

I investigated the issue #8860 for few hours now and I was finally able to
identify few problems:

    DirectSound uses a ring buffer but except from setting up a "monitoring"
thread there's nothing in its API to allow us to stop once the playback reaches
the write pointer. The result is that once it's reached, few samples of an old
buffer will be played back until the stop() function is called.
    AFAICT the last flush() function (with the wait/drain boolean set to true)
is also called too late, often few ms after the read pointer crossed the last
written buffer causing the flush to return immediately (without actually having
to wait) and it looks suspect to me. Could the TimeGet be faulty here?

While the first three patches are posted here for review the last one is
actually "hiding the bug" by clearing the buffer ahead of the write pointer in
order to silence the few extra samples that are going to be played.

Ideas and comments are welcome, especially from TypX who became the de facto
maintainer of this module ;)

Ludovic Fauvet

More information about the vlc-devel mailing list