[MPlayer-dev-eng] mplayer -gui opens /dev/mixer about 50 times a second

Dan Nicolaescu dann at ics.uci.edu
Mon Feb 11 20:26:11 CET 2008


Try:

strace -o /tmp/out -f mplayer -gui -ao oss SOME_FILE.mp3

In /tmp/out there will be a lot of sequences like this:

14941 open("/dev/mixer", O_RDONLY|O_LARGEFILE) = 10
14941 ioctl(10, 0x80044dfe, 0xbf8c99f8) = 0
14941 ioctl(10, MTRRIOC_KILL_ENTRY, 0xbf8c99fc) = 0

about 50 per second of playtime on my machine. This is with an up to
date svn checkout.

The reason is this code in mplayer.c:

#ifdef HAVE_NEW_GUI
      if(use_gui){
        guiEventHandling();
        if(mpctx->demuxer->file_format==DEMUXER_TYPE_AVI &&
      mpctx->sh_video && mpctx->sh_video->video.dwLength>2){
          // get pos from frame number / total frames
          guiIntfStruct.Position=(float)mpctx->d_video->pack_no*100.0f/mpctx->sh_video->video.dwLength;
        } else {
          guiIntfStruct.Position=demuxer_get_percent_pos(mpctx->demuxer);
        }
        if ( mpctx->sh_video )
        guiIntfStruct.TimeSec=mpctx->sh_video->pts;
          else if ( mpctx->sh_audio )
        guiIntfStruct.TimeSec=playing_audio_pts(mpctx->sh_audio,
        mpctx->d_audio, mpctx->audio_out);
        guiIntfStruct.LengthInSec=demuxer_get_time_length(mpctx->demuxer);
        guiGetEvent( guiReDraw,NULL );
        guiGetEvent( guiSetVolume,NULL );
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  This ends up causing /dev/mixer to be opened so frequently.  Is it
  really necessary to do this here? Doesn't guiEventHandling() take care
  of setting the volume?  Removing this line does not seem to cause any
  problem (but I didn't test too much).

        if(guiIntfStruct.Playing==0) break; // STOP
        if(guiIntfStruct.Playing==2) mpctx->osd_function=OSD_PAUSE;
        if ( guiIntfStruct.DiskChanged || guiIntfStruct.NewPlay ) goto
        goto_next_file;
#ifdef USE_DVDREAD



More information about the MPlayer-dev-eng mailing list