[MPlayer-dev-eng] [PATCH] demuxer_lavf mp_seek() problem

Michael Niedermayer michaelni at gmx.at
Mon Jul 9 10:49:08 CEST 2007


Hi

On Sun, Jul 08, 2007 at 12:22:12AM +0300, emild at cs.technion.ac.il wrote:
> 
> 
> Good evening everyone,
> 
> I have encountered a problem with mplayer when trying to play .flv files over
> http streaming or (or any other non-seekable streams for that matter) using the
> libavf demuxer. The playing stops almost immediately at the start and mplayer
> starts complaing about corrupted frames (i.e. unknown packet types and strange
> sizes). A sample output when running mplayer on a youtube media URL is shown at
> the end of the message.
> 
> The problem is caused by the fact that url_filesize() from libavformat/avio.c
> calls mp_seek() with a strange constant (AVSEEK_SIZE which is 0x1000) for
> whence. This causes mp_seek() to fail, (i.e. it returns -1) after which
> url_filesize() retries the call, this time with whence set to SEEK_END and
> offset set to -1. This time causes the stream to reset its offset to 0, which
> is not what we wanted and causes the corruption (the stream offset was supposed
> to remain unchanged). The attached two-line patch fixes this problem.
[...]
> Index: libmpdemux/demux_lavf.c
> ===================================================================
> --- libmpdemux/demux_lavf.c	(revision 23739)
> +++ libmpdemux/demux_lavf.c	(working copy)
> @@ -142,6 +142,8 @@
>          pos += stream->end_pos;
>      else if(whence == SEEK_SET)
>          pos += stream->start_pos;
> +    else if(whence == AVSEEK_SIZE)
> +        return stream->end_pos;
>      else
>          return -1;

this is missing a check for end_pos being valid

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070709/9dbb6f00/attachment.pgp>


More information about the MPlayer-dev-eng mailing list