[FFmpeg-devel] [PATCH] Fix seeking HTTP when server uses chunked encoding

Tomas Härdin tomas.hardin
Mon Jun 21 11:39:44 CEST 2010

On Mon, 2010-06-21 at 11:27 +0300, Martin Storsj? wrote:
> On Sun, 20 Jun 2010, Ronald S. Bultje wrote:
> > On Sun, Jun 20, 2010 at 12:57 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> > > On , 19 Jun 2010, Ronald S. Bultje wrote:
> > >> As far as I understand the issue, it's not specifiec to microhttpd, but to
> > >> any server that serves normal content using chunked encoding. Most common
> > >> http servers doesn't do that, but it's fully allowed if the client does
> > >> the request using HTTP/1.1.
> > >
> > > Content is not chunked. Content-Range is missing, indicating the server does
> > > not support seeking. Not sure why it hangs afterwards, but the failure to
> > > seek is expected.
> > 
> > The hang is likely a bug elsewhere, it happens only for some demuxers
> > (ASF), not others (RM). We can look into that, but anyway... The
> > microlibhttpd server simply doesn't support seeking, so the behaviour
> > of http.c is correct. I've added some checks to make sure it handles
> > switching between chunked/non-chunked encoding (Thomas said that was
> > an issue), but other than that, I don't think there's a bug here.
> Thanks for applying those hunks, they're correct.
> As for the problems with seeking you mentioned on irc, I guess that's due 
> to is_streamed being left at 1 in the ByteIOContext, which is the main 
> regression due to http delay opening.
> // Martin

I thought I'd pop in here to provide some feedback. Yes, the problem was
that if the server uses chunked encoding seeking didn't work. This seems
to be fixed now though, thanks :)

IIRC the HTTP spec allows specifying Content-Range (like "bytes 1234-")
without knowing the length. This is useful for resources for which the
length is not yet known, such as when watching incomplete uploads.

I've been considering a patch for all demuxers that assumes is_streamed
== 0 means url_fsize() is valid or that SEEK_END will work. movdec.c is
one of them.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100621/f3a18922/attachment.pgp>

More information about the ffmpeg-devel mailing list