[FFmpeg-cvslog] r25380 - trunk/libavformat/utils.c

Michael Niedermayer michaelni
Fri Oct 8 01:29:05 CEST 2010


On Thu, Oct 07, 2010 at 11:05:58PM +0200, Aurelien Jacobs wrote:
> On Thu, Oct 07, 2010 at 09:50:36PM +0200, Michael Niedermayer wrote:
> > On Thu, Oct 07, 2010 at 09:14:24PM +0200, Aurelien Jacobs wrote:
> > > On Thu, Oct 07, 2010 at 12:02:12AM +0200, Michael Niedermayer wrote:
> > > > On Wed, Oct 06, 2010 at 10:52:26PM +0200, aurel wrote:
> > > > > Author: aurel
> > > > > Date: Wed Oct  6 22:52:26 2010
> > > > > New Revision: 25380
> > > > > 
> > > > > Log:
> > > > > dynamically use nb_streams instead of static use of MAX_STREAMS
> > > > > 
> > > > > Modified:
> > > > >    trunk/libavformat/utils.c
> > > > > 
> > > > > Modified: trunk/libavformat/utils.c
> > > > > ==============================================================================
> > > > > --- trunk/libavformat/utils.c	Wed Oct  6 22:49:25 2010	(r25379)
> > > > > +++ trunk/libavformat/utils.c	Wed Oct  6 22:52:26 2010	(r25380)
> > > > > @@ -1879,19 +1879,24 @@ static void av_estimate_timings_from_bit
> > > > >  /* only usable for MPEG-PS streams */
> > > > >  static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
> > > > >  {
> > > > > +    unsigned int nb_streams = ic->nb_streams;
> > > > >      AVPacket pkt1, *pkt = &pkt1;
> > > > 
> > > > useless
> > > 
> > > OK
> > > 
> > > > [..]
> > > > > @@ -2172,13 +2178,18 @@ int av_find_stream_info(AVFormatContext
> > > > >      AVStream *st;
> > > > >      AVPacket pkt1, *pkt;
> > > > >      int64_t old_offset = url_ftell(ic->pb);
> > > > > +    unsigned int nb_streams = ic->nb_streams;
> > > > >      struct {
> > > > >          int64_t last_dts;
> > > > 
> > > > same
> > > 
> > > OK
> > > 
> > > > >          int64_t duration_gcd;
> > > > >          int duration_count;
> > > > >          double duration_error[MAX_STD_TIMEBASES];
> > > > >          int64_t codec_info_duration;
> > > > > -    } info[MAX_STREAMS] = {{0}};
> > > > > +    } *info, *tmp_info;
> > > > 
> > > > 
> > > > this struct too belongs in AVStream, allocated in av_new_stream()
> > > > freed at the end of find_stream_info()
> > > 
> > > OK. Attached patch does this.
> > > It looks a little bit ugly to me to have this struct in AVStream, but
> > > overall, this is indeed much better than the current situation.
> > > 
> > > > peppering teh code with checks if a stream was
> > > > added after every call to lavf and then reallocating arrays is very hackish
> > > > and fragile
> > > 
> > > Indeed, I have to agree.
> > > 
> > > Aurel
> > >  avformat.h |   12 ++++++++
> > >  utils.c    |   87 +++++++++++++++++++++++--------------------------------------
> > >  2 files changed, 45 insertions(+), 54 deletions(-)
> > > 198eee1dfcebb6dfee7b584f2447133b2b66974d  find_stream_info.diff
> > 
> > i think this is missing some freeing at closing time in case streams where
> > added after find_stream_info()
> 
> Absolutely right.
> New patch attached.
> 
> Aurel
>  ffmpeg.c               |    1 
>  libavformat/avformat.h |   12 ++++++
>  libavformat/utils.c    |   89 +++++++++++++++++++------------------------------
>  3 files changed, 48 insertions(+), 54 deletions(-)
> 4956d11f6cf531160e7c1f2a211b5f76f64966c8  find_stream_info2.diff

ok if make fate and valgrind of something passes no worse than before

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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-cvslog/attachments/20101008/b2d62f89/attachment.pgp>



More information about the ffmpeg-cvslog mailing list