[vorbis-dev] [PATCH] make vorbis work with KDE 3.0

Martin Vogt mvogt at rhrk.uni-kl.de
Wed Mar 20 00:56:48 PST 2002



On Tue, Mar 19, 2002 at 07:47:20PM +1100, Michael Smith wrote:
> At 10:45 AM 3/18/02 +0100, you wrote:
> >
> >
> >Hello,
> >
> >the appended Patch makes vorbis work on KDE 3.0.(again)
> >
> >The bug is that the goto seek_error calls in ov_pcm_seek_page
> >do not set the return value in the error case.
> >
> Though there may be (it looks like there is) a bug here, this
> fix is definately incorrect (you've changed it to return the
> wrong error code - which in the buggy cases is better than no
> error code, admittedly). I'll take a closer look and see
> if I can fix it properly.
>
It was a quick and dirty fix, I know. But before I started
to make a cleaner one, I like to have a feedback that
its actually a bug.

 
> Your reasoning doesn't entirely make sense, in that the 
> goto seek_error calls are never reached if the stream has
> been closed (as you say it has been in this case). Sounds
> like there's a nasty bug in your multimedia player as well.
>
I can explain the situation, it has to do with threads.

Vorbis decodes in its own thread and reads from the
callbacks the input data.
User presses "stop" in the player, then the "GUI" thread
closes the input fd. (stream is closed)
If vorbis is doing a seek this "race" occurs:

Row 1027
int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
  int link=-1,ret=0; <- default to "success"
[...]
 Row 1086
         // here the stream is closed by the other thread (GUI)
         result=_get_next_page(vf,&og,end-vf->offset);
         // vorbis sees the "closed stream"
         if(result==OV_EREAD) goto seek_error;

Row 1175 
  seek_error:
  /* dump machine so we're in a known state */
  vf->pcm_offset=-1;
  _decode_clear(vf);
  return ret;  <- RETURN SUCESS !

ret has the value "0" here, although an error occured.
Because the _decode_clear(vf); frees internal structures but
does not indicate the error to the higher functions the
later code segfaults.

No, the current CVS commit:(1.60)

            granulepos-=vf->pcmlengths[link*2];

---
> 
>             if(vf->seekable && link>0)
>               granulepos-=vf->pcmlengths[link*2];

did not fix the bug.
This is my segfault:

KDE sound server:
[kde at mv kde]$ artsd -S 4096 -F 10
read on not open file want:8500
Segmentation fault

Command line KDE player:
[kde at mv lib]$ mpeglibartsplay -2 /mnt/diskD/save/ogg/Marque.ogg 
cnt:0
Segmentation fault

The -2 is a stresstest to trigger the mentioned race.
You see that "read on not open file want:8500" is vorbis decode
thread, while the gui cloesed the fd.
(The "stresstest" is a common case in the kde player, thus
stresstest is a wrong name)

>Can you file this bug at http://bugs.xiph.org (bugzilla)
done.

regards,

Martin

<p>--- >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