[FFmpeg-devel] [RFC] Questions and suggestions regarding AVSEEK_FORCE?

Tomas Härdin tomas.hardin
Wed Mar 31 16:56:11 CEST 2010


On Wed, 2010-03-31 at 12:34 +0200, Michael Niedermayer wrote:
> On Tue, Mar 30, 2010 at 01:56:24PM +0200, Tomas H?rdin wrote:
> > 
> > Digging around some more it seems that offset stems from
> > dv_read_header(). For some reason the four-byte state that should be
> > 0x1f07003f (after anding) at dv.c:414 is 0x0a2feb0f instead. That does
> > not match what the file says at all (which says 0x1f0700bf).
> > Unsurprisingly, the proper value shows up 12928 B later. This leads me
> > to believe something messes up the ByteIOContext buffer before
> > dv_read_header() is called - probably after the probing is done.
> 
> maybe its:
>     if (url_fseek(*pb, 0, SEEK_SET) < 0) {
>         url_fclose(*pb);
>         if (url_fopen(pb, filename, URL_RDONLY) < 0)
>             return AVERROR(EIO);
>     }
> from ff_probe_input_buffer()
> 
> this doesnt look like it could work with pipes
> what happens if you limit the max probing size there to a value smaller than
> our internal buffer? (so seek back would be guranteed to work)

Limiting PROBE_BUF_MAX to 16 KiB makes it work, which makes sense since
that seek will fail for probe buffers. I've figured out a simple
solution: rewind the ByteIOContext by joining the probe buffer and the
context's buffer, taking the overlap between them into consideration.	

I've attached a patch that replaces the above block of code with a call
to a new function: url_rewind_with_probe_data()
This basically means a seek is avoided in all cases, not just for pipes,
which reduce the initial delay when demuxing most sources (especially
HTTP).

The patch can also be used with the patch I attached earlier in this
thread (skipping_stream_seek.patch). In fact, that patch is fairly
useless without this one.

Finally, the patch passes the regression tests.

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nonseeking_probe_rewind.patch
Type: text/x-patch
Size: 3118 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100331/1824e0b3/attachment.bin>



More information about the ffmpeg-devel mailing list