[Ffmpeg-devel] ffplay broken in latest svn

Michael Niedermayer michaelni
Tue Jan 9 02:39:33 CET 2007


Hi

On Mon, Jan 08, 2007 at 08:06:37PM +0200, Nikns Siankin wrote:
> On Mon, Jan 08, 2007 at 05:05:10PM +0100, Michael Niedermayer wrote:
> >Hi
> >
> >On Mon, Jan 08, 2007 at 05:04:32PM +0200, Nikns Siankin wrote:
> >> On Fri, Jan 05, 2007 at 03:55:27PM +0100, Michael Niedermayer wrote:
> >> >Hi
> >> >
> >> >On Wed, Jan 03, 2007 at 11:31:46AM +0200, Nikns Siankin wrote:
> >> >> ffplay seems broken in svn 20070102.
> [...]
> >> >
> >> >try to av_mallocz() duration_error and if it fixes the issue submit a patch
> >> 
> >> It fixed.
> >> Here is patch:
> >> 
> >> 
> >> --- libavformat/utils.c.orig	Tue Jan  2 22:35:46 2007
> >> +++ libavformat/utils.c	Mon Jan  8 16:55:12 2007
> >> @@ -1778,14 +1778,19 @@ static int get_std_framerate(int i){
> >>   */
> >>  int av_find_stream_info(AVFormatContext *ic)
> >>  {
> >> -    int i, count, ret, read_size, j;
> >> +    int i, count, ret, read_size, j, k;
> >>      AVStream *st;
> >>      AVPacket pkt1, *pkt;
> >>      AVPacketList *pktl=NULL, **ppktl;
> >>      int64_t last_dts[MAX_STREAMS];
> >>      int duration_count[MAX_STREAMS]={0};
> >> -    double duration_error[MAX_STREAMS][MAX_STD_TIMEBASES]={{0}}; //FIXME malloc()?
> >> +    double **duration_error;
> >>  
> >> +    duration_error = (double **) av_mallocz(MAX_STREAMS* sizeof(double *));
> >> +
> >> +    for (k=0;k<MAX_STREAMS;k++)
> >> +        duration_error[k] = (double *) av_mallocz(MAX_STD_TIMEBASES* sizeof(double));
> >
> >duration_error= av_mallocz(MAX_STREAMS * MAX_STD_TIMEBASES * sizeof(double));
> >
> >much simpler ...
> 
> 
> --- libavformat/utils.c.orig	Tue Jan  2 22:35:46 2007
> +++ libavformat/utils.c	Mon Jan  8 19:57:03 2007
> @@ -1784,7 +1784,7 @@ int av_find_stream_info(AVFormatContext 
>      AVPacketList *pktl=NULL, **ppktl;
>      int64_t last_dts[MAX_STREAMS];
>      int duration_count[MAX_STREAMS]={0};
> -    double duration_error[MAX_STREAMS][MAX_STD_TIMEBASES]={{0}}; //FIXME malloc()?
> +    double *duration_error = av_mallocz(MAX_STREAMS * MAX_STD_TIMEBASES * sizeof(duration_error));
>  
>      for(i=0;i<ic->nb_streams;i++) {
>          st = ic->streams[i];
> @@ -1896,12 +1896,12 @@ int av_find_stream_info(AVFormatContext 
>  //                if(st->codec->codec_type == CODEC_TYPE_VIDEO)
>  //                    av_log(NULL, AV_LOG_ERROR, "%f\n", dur);
>                  if(duration_count[index] < 2)
> -                    memset(duration_error, 0, sizeof(duration_error));
> +                    memset(duration_error, 0, MAX_STREAMS * MAX_STD_TIMEBASES * sizeof(duration_error));
>                  for(i=1; i<MAX_STD_TIMEBASES; i++){
>                      int framerate= get_std_framerate(i);
>                      int ticks= lrintf(dur*framerate/(1001*12));
>                      double error= dur - ticks*1001*12/(double)framerate;
> -                    duration_error[index][i] += error*error;
> +                    duration_error[index*MAX_STREAMS+i] += error*error;

double (*duration_error)[MAX_STD_TIMEBASES] = av_mallocz(MAX_STREAMS * MAX_STD_TIMEBASES * sizeof(duration_error));

makes this and he next change unneeded

except this iam fine with the patch ...

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070109/fd7f62b4/attachment.pgp>



More information about the ffmpeg-devel mailing list