[Mplayer-dev-eng] Re: [Mplayer-cvslog] CVS: main/libao2 ao_null.c,1.3,1.4

Juergen Keil jk at tools.de
Thu Aug 30 12:42:48 CEST 2001


> Modified Files:
>         ao_null.c 
> Log Message:
> fixed ehh.
> 
> Index: ao_null.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libao2/ao_null.c,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- ao_null.c   5 Jun 2001 18:40:44 -0000       1.3
> +++ ao_null.c   29 Aug 2001 21:08:12 -0000      1.4
> @@ -33,7 +33,7 @@
>  
>      ao_outburst=4096;
>  
> -    return 1;
> +    return 0;
>  }
>  
>  // close audio device

Is the above patch intended to fix the '-ao null -benchmark' Problems?

By failing the audio init for the 'null' audio device, mplayer runs
more or less in same mode as '-noaudio' mode, and that produces better
benchmark results.


My idea for the '-ao null -benchmark' fix is to always skip the usec_sleep
for A-V sync, when we run in benchmark mode.

Currently the code skips the usec_sleep for A-V sync when no audio
device is in use or the audio has reached the end-of-stream and
benchmark mode is enabled.  But if we have a valid audio device and the
audio stream has not reached the end-of-stream and video happens to be
ahead of the audio stream (this can happen with the ao_null device),
we end up calling usec_sleep, even when we are in benchmark mode:


Pseudo-code from mplayer.c:

     // It's time to sleep...

     if(sh_audio && !d_audio->eof){
     	// compute 'time_frame' from audio_out/sh_audio/sh_video ...
     	// ... 'benchmark' is ignored here...
     } else {
        if( (time_frame<-3*frame_time || time_frame>3*frame_time) || benchmark)
          time_frame=0;
     }
     
     // use usec_sleep to sleep for time_frame seconds
     while (time_frame>0.005) {
        ...     
     	usec_sleep(time_frame)
        ...
     }
     

My idea was to ignore the frame_time A-V sync usec_sleep in both cases,
like this (for a real patch, see the attachment):

     // It's time to sleep...

     if(sh_audio && !d_audio->eof){
     	// compute 'time_frame' from audio_out/sh_audio/sh_video ...
     } else {
        if( (time_frame<-3*frame_time || time_frame>3*frame_time))
          time_frame=0;
     }
     
     if (benchmark) time_frame=0;	// never delay in benchmark mode
     
     // use usec_sleep to sleep for time_frame seconds
     while (time_frame>0.005) {
        ...     
     	usec_sleep(time_frame)
        ...
     }
     


With this change, you can '-benchmark' either in '-nosound' mode (no 
audio decoding) or in '-ao null' mode (with audio decoding times).

Comments?

-- 
Jürgen Keil          		jk at tools.de
Tools GmbH			+49 (228) 9858011
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.253
diff -u -B -r1.253 mplayer.c
--- mplayer.c   29 Aug 2001 20:22:23 -0000      1.253
+++ mplayer.c   30 Aug 2001 10:15:47 -0000
@@ -1304,10 +1304,13 @@
              mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nframe drop %d, %.2f\n", drop_frame, time_frame);
          }
       } else {
-          if( (time_frame<-3*frame_time || time_frame>3*frame_time) || benchmark)
+          if( (time_frame<-3*frame_time || time_frame>3*frame_time))
              time_frame=0;
          
       }
+
+      if (benchmark)
+          time_frame=0;
 
 //      if(verbose>1)printf("sleep: %5.3f  a:%6.3f  v:%6.3f  \n",time_frame,sh_audio->timer,sh_video->timer);
 
Index: libao2/ao_null.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_null.c,v
retrieving revision 1.4
diff -u -B -r1.4 ao_null.c
--- libao2/ao_null.c    29 Aug 2001 21:08:12 -0000      1.4
+++ libao2/ao_null.c    30 Aug 2001 10:15:47 -0000
@@ -33,7 +33,7 @@
 
     ao_outburst=4096;
 
-    return 0;
+    return 1;
 }
 
 // close audio device


More information about the MPlayer-dev-eng mailing list