[Ffmpeg-devel] ffplay broken in latest svn

Nikns Siankin nikns
Mon Jan 8 16:04:32 CET 2007


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.
>> 
>> # ffplay -h 
>> ffplay version SVN-r7400, Copyright (c) 2003-2006 Fabrice Bellard, et al.
>> 
>> # uname -a
>> OpenBSD obsd.my.domain 4.0 GENERIC#690 amd64
>> 
>> (gdb) bt
>> #0  0x0000000042fc29a2 in av_find_stream_info (ic=Cannot access memory at 
>> address 0x43cde708
>> ) at utils.c:1780
>> #1  0x0000000000405f17 in decode_thread (arg=0x4d882000) at ffplay.c:1868
>> #2  0x000000004a2f2ad7 in SDL_RunThread () from /usr/local/lib/libSDL.so.6.0
>> #3  0x000000004a2f2c89 in RunThread () from /usr/local/lib/libSDL.so.6.0
>> #4  0x0000000049a8a28d in _thread_start () at 
>> /usr/src/lib/libpthread/uthread/uthread_create.c:244
>> #5  0x000000000000001f in ?? ()
>> #6  0x0000000000000000 in ?? ()
>> (gdb) disass $pc-32 $pc+32
>> Dump of assembler code from 0x42fc2982 to 0x42fc29c2:
>> 0x0000000042fc2982 <av_find_stream_info+2>:     mov    $0xa,%ecx
>> 0x0000000042fc2987 <av_find_stream_info+7>:     push   %r14
>> 0x0000000042fc2989 <av_find_stream_info+9>:     push   %r13
>> 0x0000000042fc298b <av_find_stream_info+11>:    push   %r12
>> 0x0000000042fc298d <av_find_stream_info+13>:    xor    %r12d,%r12d
>> 0x0000000042fc2990 <av_find_stream_info+16>:    push   %rbp
>> 0x0000000042fc2991 <av_find_stream_info+17>:    xor    %ebp,%ebp
>> 0x0000000042fc2993 <av_find_stream_info+19>:    push   %rbx
>> 0x0000000042fc2994 <av_find_stream_info+20>:    sub    $0x1c7e8,%rsp
>> 0x0000000042fc299b <av_find_stream_info+27>:    mov    3596062(%rip),%rax        
>> # 0x433308c0 <gxf_muxer+1089344>
>> 0x0000000042fc29a2 <av_find_stream_info+34>:    mov    %rdi,0x68(%rsp)
>> 0x0000000042fc29a7 <av_find_stream_info+39>:    lea    0x80(%rsp),%r14
>> 0x0000000042fc29af <av_find_stream_info+47>:    cld    
>> 0x0000000042fc29b0 <av_find_stream_info+48>:    mov    (%rax),%rax
>> 0x0000000042fc29b3 <av_find_stream_info+51>:    mov    %rax,0x1c7d0(%rsp)
>> 0x0000000042fc29bb <av_find_stream_info+59>:    lea    0x1c5a0(%rsp),%rax
>
>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));
+
     for(i=0;i<ic->nb_streams;i++) {
         st = ic->streams[i];
         if(st->codec->codec_type == CODEC_TYPE_VIDEO){
@@ -1896,7 +1901,8 @@ 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));
+                    for (k=0;k<MAX_STREAMS;k++)
+                        memset(duration_error[k], 0, MAX_STD_TIMEBASES* sizeof(double));
                 for(i=1; i<MAX_STD_TIMEBASES; i++){
                     int framerate= get_std_framerate(i);
                     int ticks= lrintf(dur*framerate/(1001*12));
@@ -2016,6 +2022,13 @@ int av_find_stream_info(AVFormatContext 
         }
     }
 #endif
+
+    for (k=0;k<MAX_STREAMS;k++)
+        av_freep(&duration_error[k]);
+
+    av_freep(&duration_error);
+
+
     return ret;
 }
 




More information about the ffmpeg-devel mailing list