[vorbis-dev] bug in vorbisfile with threads
Martin Vogt
mvogt at rhrk.uni-kl.de
Sun Nov 25 10:10:28 PST 2001
Hello,
vorbisfile is not linked against pthreads:
>ldd /usr/lib/libvorbis.so
> libm.so.6 => /lib/libm.so.6 (0x40034000)
> libogg.so.0 => /usr/lib/libogg.so.0 (0x40057000)
> libc.so.6 => /lib/libc.so.6 (0x4005c000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
When vorbis is used in the KDE Media player (which uses vorbisfile
from a seperate thread) this code in vorbisfile makes trouble:
>static long _get_data(OggVorbis_File *vf){
> errno=0;
> if(vf->datasource){
> char *buffer=ogg_sync_buffer(&vf->oy,CHUNKSIZE);
> long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
> if(bytes>0)ogg_sync_wrote(&vf->oy,bytes);
> if(bytes==0 && errno)return(-1);
> return(bytes);
> }else
> return(0);
>}
reason: errno is a global variable, but when you compile the code
with include <pthreads.h> its replaced with a function call.
Thus the assumption that the read callback sets the errno variable
is wrong, when the callbacks are compiled with pthreads support.
This is the problem we see in the KDE Media player.
I think this solution would be fine:
- add another callback to the callback structure: errno_func
- this callback (if its != NULL) can be used to get the error condition
- if its not set : fallback to errno .
What do you think?
regards,
Martin
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list