[MPlayer-dev-eng] [PATCH] bad seeking in stream.c, buffer flushed to early

Ivan Kalvachev ivan at cacad.com
Mon Sep 13 12:27:12 CEST 2004


Reimar Döffinger said:
> Hi,
> stream_seek_long first sets s->buf_pos=s->buf_len=0; (thus clearing the
> buffer) before attempting to seek, which effectively makes it seek
> forward instead of backwards on linear streams (e.g. when doing cat test
> | mplayer -nocache -).
> Simply commenting this out made it work for me and I couldn't detect any
> ill effects, but somebody who knows this code should check this.

Don't think this is good idea. The name *_seek_long meen that we must
seek, thus empty the buffer.

I guess that the real fix should take place in
libmpdemux/stream.h::215::

inline static int stream_seek(stream_t *s,off_t pos){

  mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos);

  if(pos<s->pos){
    off_t x=pos-(s->pos-s->buf_len);
    if(x>=0){
      s->buf_pos=x;
//      putchar('*');fflush(stdout);
      return 1;
    }
  }

  return cache_stream_seek_long(s,pos);
}


Wish You Luck
   Ivan Kalvachev
  iive




More information about the MPlayer-dev-eng mailing list