[FFmpeg-devel] [PATCH 12/12] asfdec: read the index while reading the header, not on first seek

Anton Khirnov anton
Thu Feb 10 14:10:26 CET 2011


On Thu, Feb 10, 2011 at 09:35:42AM +0100, Vladimir Pantelic wrote:
> Anton Khirnov wrote:
> >it makes more sense and gets rid of a variable from ASFContext.
> >
> >asf_build_simple_index() is changed to use ASFContext.data_ofsset
> >instead of AVFormatContext.data_offset, since the latter isn't set yet.
> >---
> >  libavformat/asfdec.c |  136 ++++++++++++++++++++++++--------------------------
> >  1 files changed, 66 insertions(+), 70 deletions(-)
> >
> >  static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
> >  {
> >      ASFContext *asf = s->priv_data;
> >@@ -650,6 +712,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
> >      asf->data_offset = url_ftell(pb);
> >      asf->packet_size_left = 0;
> >
> >+    if (!(url_is_streamed(s->pb) || s->flags&  AVFMT_FLAG_IGNIDX))
> >+        asf_build_simple_index(s);
> >
> >      for(i=0; i<128; i++){
> >          int stream_num= asf->asfid2avid[i];
> >@@ -1145,73 +1209,8 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
> >      return pts;
> >  }
> 
> will that not make startup time longer on a "slow" link?

Yes it will, but with current code you get the same delay on first
seek, which looks worse to the user IMO.
I don't have much experience with streaming though, so I'd appeciate
opinions from somoeone who does.

-- 
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110210/16433bea/attachment.pgp>



More information about the ffmpeg-devel mailing list