[FFmpeg-cvslog] r13061 - trunk/libavformat/avio.c

Michael Niedermayer michaelni
Thu May 8 21:50:32 CEST 2008


On Thu, May 08, 2008 at 11:25:46AM -0700, Corey Hickey wrote:
> Michael Niedermayer wrote:
> > On Wed, May 07, 2008 at 12:00:01PM -0700, Corey Hickey wrote:
> >> michael wrote:
> >>> Author: michael
> >>> Date: Mon May  5 11:17:56 2008
> >>> New Revision: 13061
> >>>
> >>> Log:
> >>> Check url_seek() in url_open().
> >>>
> >>>
> >>> Modified:
> >>>    trunk/libavformat/avio.c
> >>>
> >>> Modified: trunk/libavformat/avio.c
> >>> ==============================================================================
> >>> --- trunk/libavformat/avio.c	(original)
> >>> +++ trunk/libavformat/avio.c	Mon May  5 11:17:56 2008
> >>> @@ -113,6 +113,12 @@ int url_open(URLContext **puc, const cha
> >>>          *puc = NULL;
> >>>          return err;
> >>>      }
> >>> +
> >>> +    //We must be carefull here as url_seek() could be slow, for example for http
> >>> +    if(   (flags & (URL_WRONLY | URL_RDWR))
> >>> +       || !strcmp(proto_str, "file"))
> >>> +        if(!uc->is_streamed && url_seek(uc, 0, SEEK_SET) < 0)
> >>> +            uc->is_streamed= 1;
> >>>      *puc = uc;
> >>>      return 0;
> >>>   fail:
> >> This patch makes mencoder segfault with lavf muxing. I don't know if
> >> mencoder or lavf should be changed, so I'm reporting it here as a start.
> >>
> >> Steps to reproduce:
> >> $ mencoder -nosound -ovc copy -of lavf input.avi -o output.avi
> >>
> >> Here's what appears to be happening:
> >> 1. The new code in avio.c calls url_seek()
> >> 2. url_seek() calls a pointer to mp_seek()  (in muxer_lavf.c)
> >> 3. mp_seek hits a null pointer dereference because muxer is null
> >> ----however----
> >> 4. muxer is set in muxer_lavf.c immediately below the code that calls
> >>    libavformat and does what I described above.
> >>
> >> I can't just move that line that sets muxer because it's actually
> >> storing muxer in a URLContext struct member, and the pointer to that
> >> struct isn't set until after the code that now segfaults. Here's the
> >> code in muxer_lavf.c I'm talking about:
> >>
> >> -------------------------------------------------------------------
> >> if(url_fopen(&priv->oc->pb, mp_filename, URL_WRONLY))
> >> {
> >> 	mp_msg(MSGT_MUXER, MSGL_FATAL, "Could not open outfile\n");
> >>         goto fail;
> >> }
> > 
> >> ((URLContext*)(priv->oc->pb->opaque))->priv_data= muxer;
> > 
> > mp_open() should set this IMHO.
> > (for example by using mp_filename "menc://%p" or a static var)
> 
> Thanks, but I don't understand what you mean. I've looked at the
> relevant code and I think I can tell what it's doing, but I keep coming
> back to what looks like a circular dependency.
> 
> If it's not much trouble for you, feel free to explain your solution by
> committing a patch and letting me read -cvslog. ;)  Otherwise, the only

Iam not interrested in working on mplayer currently, maybe i will step back
as maintainer of all mplayer code for which iam maintainer, maybe not
ive not decided yet. But i prefer to work on projects where the developers
can affect decissions about the project and themselfs.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20080508/9fbefbac/attachment.pgp>



More information about the ffmpeg-cvslog mailing list