[FFmpeg-devel] [PATCH] http: try to detect live akamai streams and dont enable seeking for them

Michael Niedermayer michaelni at gmx.at
Mon Jun 4 02:28:17 CEST 2012


On Mon, Jun 04, 2012 at 02:25:57AM +0200, Michael Niedermayer wrote:
> On Sun, Jun 03, 2012 at 10:38:14PM +0200, Reimar Döffinger wrote:
> > On Sun, Jun 03, 2012 at 06:43:33PM +0200, Clément Bœsch wrote:
> > > On Sun, Jun 03, 2012 at 06:36:34PM +0200, Michael Niedermayer wrote:
> > > > Fixes ticket1320
> > > > 
> > > > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > > > ---
> > > >  libavformat/http.c |    6 +++++-
> > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/libavformat/http.c b/libavformat/http.c
> > > > index 9a5ca62..28a777c 100644
> > > > --- a/libavformat/http.c
> > > > +++ b/libavformat/http.c
> > > > @@ -57,6 +57,7 @@ typedef struct {
> > > >      int multiple_requests;  /**< A flag which indicates if we use persistent connections. */
> > > >      uint8_t *post_data;
> > > >      int post_datalen;
> > > > +    int is_akamai;
> > > >  } HTTPContext;
> > > >  
> > > >  #define OFFSET(x) offsetof(HTTPContext, x)
> > > > @@ -318,7 +319,8 @@ static int process_line(URLContext *h, char *line, int line_count,
> > > >                  if ((slash = strchr(p, '/')) && strlen(slash) > 0)
> > > >                      s->filesize = atoll(slash+1);
> > > >              }
> > > > -            h->is_streamed = 0; /* we _can_ in fact seek */
> > > > +            if (!s->is_akamai || s->filesize != 2147483647)
> > > > +                h->is_streamed = 0; /* we _can_ in fact seek */
> > > >          } else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) {
> > > >              h->is_streamed = 0;
> > > >          } else if (!av_strcasecmp (tag, "Transfer-Encoding") && !av_strncasecmp(p, "chunked", 7)) {
> > > > @@ -333,6 +335,8 @@ static int process_line(URLContext *h, char *line, int line_count,
> > > >          } else if (!av_strcasecmp (tag, "Connection")) {
> > > >              if (!strcmp(p, "close"))
> > > >                  s->willclose = 1;
> > > > +        } else if (!av_strcasecmp (tag, "Server") && !av_strcasecmp (p, "AkamaiGHost")) {
> > > > +            s->is_akamai = 1;
> > > >          }
> > > >      }
> > > 
> > > This reminds me of a similar issue Reimar fixed in MPlayer by adding
> > > another exception (IIRC it was Youtube); this might be a fairly common
> > > issue with some webservers, so maybe a more generic attribute could be
> > > used? (broken_httpserver or something).
> > 
> > I'm not sure if FFmpeg's http implementation can detect it in some other
> > way, however it is true that in MPlayer we have two other broken cases
> > (and we lack this one). YouTube and MakeMKV are those.
> > (see stream/http.c:758).
> 
> do you have testcases for the 2 ?
> so we can check if ffmpeg needs such checks too ?

s/we/i/

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120604/be94f3b6/attachment.asc>


More information about the ffmpeg-devel mailing list