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@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Hello, because no one commented on the last posting, I tried to make a patch for the global variable problem. It looks like, that the bug with the errno variable cannot be solved in a: i) binary compatible ii) source compatible way.(when we leave the errno check in) I can prepare such a patch, but this breaks everything. Not fixing this bug would mean the vorbisfile is not re-entrant. Another solution: ----------------- Another way to fix the race is to remove the errno check completely. (I really prefer this solution.) 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@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
At 01:36 PM 11/27/01 +0100, you wrote:> > >Hello, > >because no one commented on the last posting, >I tried to make a patch for the global variable problem.As far as I can tell, your diagnosis of the problem was incorrect. errno becomes a function call (to __errno_location(), I think), wrapped in a macro, if you define _REENTRANT when compiling your program. The vorbis build system does this (if it misses it on some platforms that need it, that''d be a bug). Actually linking to pthreads is irrelevent here, unless something else is going wrong. errno should always be giving the correct value. Michael --- >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@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Hello, IMHO opinion the errno check should be removed. I believe it is a false assumption that the read callback uses the errno. Especially when the callback uses non-unix file IO such as in memory buffers or win32 file functions. A solution, that would break binary compatibility, is to use an ferror() type callback function. Warren. ----- Original Message ----- From: "Martin Vogt" <mvogt@rhrk.uni-kl.de>> >It looks like, that the bug with the errno variable >cannot be solved in a: > >i) binary compatible >ii) source compatible > >way.(when we leave the errno check in) > >I can prepare such a patch, but this breaks everything. >Not fixing this bug would mean the vorbisfile is not >re-entrant. > >Another solution: >----------------- > >Another way to fix the race is to remove the errno check >completely. (I really prefer this solution.) >_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp --- >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@xiph.org'' containing only the word ''unsubscribe'' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.