[vorbis-dev] Re: ogg123 1.0rc3 thread issue [FIXED] [#112]
Kenneth Arnold
ken at arnoldnet.net
Mon Jan 21 13:08:50 PST 2002
On Mon, Jan 21, 2002 at 06:35:04PM +0000, Christian Weisgerber wrote:
> (Actually it didn't. Too often it would just stop playing while
> it continued to decode. Probably a race in the old shared memory
> code. I've always found the lack of use of semaphores suspicious
> there. But when it was playing, it was playing fine, with cpu to
> spare.)
The old shared memory code was a mess at best. That's why I rewrote
it, and then Stan rewrote my rewrite. The result should be a generally
usable (for GPL-compatible programs), flexible buffer "library".
> ogg123 build with GNU pth runs, but playing through libao's sun
> module is choppy and halting (at 50% idle). Unusable.
GNU pth is pretty much defeating the point of having a threaded buffer
to begin with. One thread is doing the reading and processing, and one
is spinning out pretty much nothing but writes to the sound
output. GNU pth is going to make them trade back and forth, so ogg123
will alternate from decoding a chunk to playing it to decoding the
next and so on. If the decode part can't be done before the output
"thread" can fill the sound card's buffer again, it's going to skip a
little. Perhaps ogg123 is really taking ~100% CPU to decode a chunk,
then must spend that same amount of time waiting for it to play, hence
the 50% utilization and the choppiness.
> By contrast, "ogg123 -d raw -f - ... | pcmplay -" works reasonably
> well, and with an instance of buffer(1) in between it works very
> nicely.
I think there is a small buffer (on some platforms) for pipes, and
it's writing directly out instead of going through the buffer
processing (which involves some thread talking). The buffer wasn't
designed for one-thread-at-a-time execution, so it's going to be
inefficient.
> [pcmplay, part of the tosha package, is just a read()-write() loop.
> buffer is a two-process, shared memory buffering tool built with
> SYSVSHM/SYSVSEM.]
I'm suprised the SysV "threads" work on a BSD system better than POSIX
threads.
--
Kenneth Arnold <ken at arnoldnet.net>
- "Know thyself."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: part
Type: application/pgp-signature
Size: 233 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20020121/ef053ccb/part.pgp
More information about the Vorbis-dev
mailing list