Re: [bug] xmms generating to many wakeups when idle
"Carlos R. Mafra" <[email protected]> Tue, 28 Aug 2007 13:31:01 -0300
| Newsgroups | gmane.comp.multimedia.xmms.devel |
|---|---|
| Message-ID | <[email protected]> |
I've played a little bit with xmms-1.2.10 source code today, trying to reduce the number of wakeups when _idle_ (i.e. not playing). The last time I tryed to tune things up I had trouble because I was not installing xmms after compiling, and rather executing it by going inside the directory source and typing ./xmms & Today I've finally managed to test my modifications, and here is the result of it. The main wakeup-offender is this line in main.c mainwin_timeout_tag = gtk_timeout_add(10, idle_func, NULL); The current 1.2.10 xmms generates approx. 93 wakeups when idle. After testing some other values instead of "10" in the above line I concluded that the best value for it should be 1000 -- the resulting xmms then generates 13 wakeups when idle (and approx. 100 when playing mp3's). I want to stress that xmms behaves normally and everything is fine when idle and during playback. I chose 1000 because then the elapsed time in xmms main window is updated each 1 second. If I put 2000 then it gets updated each 2 seconds, but the wakeup counting does change much (approx. 12.5). I also have made more tests. If I comment this line I get exactly 12.0 wakeups when idle and xmms works fine, except that the elapsed time is not shown anymore and when changing the song with the keyboard, the song title doesn't change also. I don't know yet who is responsable for the background 12.0 wakeups. But now I think I get the picture. This line in the code is there to periodically poll the song title and to poll and display the elapsed time. So if my conclusion is right, this is what xmms should be doing instead: 1) If the user starts playing a song (with the 'x' key or double clicking on the song title in the playlist), then display the song title in the main window and update the elapsed time each second. Maybe that could be done by executing the above line of code with the value of 1000. 2) When the user stops playing songs, also remove the periodic poll/display of elapsed time and song title. I will try to implement this idea on my xmms source code when I get time. But until then, I will be using my patched xmms with 13 wakeups when idle :-) Carlos R. Mafra Carlos R. Mafra wrote: > Dirk Jagdmann wrote: >>> I have also tried to take a look at xmms code, and I found out that >>> one of the major causes of wakeups is this line in main.c: >>> >>> mainwin_timeout_tag = gtk_timeout_add(10, idle_func, NULL); >>> >>> If I increase the number 10, I get less wakeups. If I comment the whole >>> line the number of wakeups decrease a lot (I get 10 instead of 93). >>> >>> However, I don't know the effect of changing this value, because to >>> make the vanilla xmms 1.2.10 compile with gcc-4.2.1 I had to change >>> some things (I removed two lines from General/ir/ir.h). Xmms then >>> compiles fine, but is unable to load and play songs. Modifying the >>> source code further to decrease the wakeups, I get the same behaviour >>> (does not play). >> >> I'm not surprised. This is the way xmms works, and the only way audio >> apps can be written with OSS like audio driver models. You have to do > > Well, I am not sure if I explained well the problem. I am measuring the > number of wakeups when xmms is _not_ playing anything. > > And what I said is that I had to change the source code to make it > compile with gcc-4.2 before doing any changes to reduce wakeups. And > after doing this xmms compiles and is executed sucesfully, but does not > play sounds. So I am not sure what my changes to reduce wakeups > break, because it is already broken before. > > >> some busy looping, then check your audio driver how much buffer size >> you can render to, then render new audio frames. Only modern audio >> models like ALSA or JACK have a callback interface, where the audio >> driver (or it's library) driver your application. This would allow for >> better cpu usage. If you simply disable xmms busy loop you have halted >> your player. > > I think the problem is not in the code which is responsable for playing > things. I am not concerned with wakeups when the player is busy playing > songs, but when it is idle. > > I would like xmms to not generate wakeups when staying still. I think > the right behaviour would be something like this: 0 wakeups when open > and idle, then the user click "Play" and only then the playing code > starts to work and generate wakeups. > >> But please keep in mind, that generelly multi-media-playback and long >> cpu sleep intervals are sort of mutually exclusive. > > Sure, but when _playing_ and not when idle. > > Carlos R. Mafra > > _______________________________________________ > xmms-devel mailing list > [email protected] > http://lists.xmms.org/mailman/listinfo/xmms-devel >