Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15385

high CPU usage caused by Phonon although no sound is played

    XMLWordPrintable

Details

    Description

      I programmed a widget for Qt 4.7.0 on the n900. It is called BuliScores and the source code can be found here (its actually very simple and I only use 2 MediaObjects in mainwidget.cpp, thats all!):

      https://garage.maemo.org/scm/?group_id=1890

      The problem I see is constant unmotivated CPU usage by my widget (2-4% and /usr/bin/pulseaudio (13-20%) which drains the battery in no time...). My widget uses phonon to play mp3 files. (see mainwidget.cpp, it contains all the phonon calls). The high CPU usage doesn't show immediately, it's hard to reproduce but it showed up several times now. This time I tried to investigate, here is what I did and find out:

      I created strace logs of both, the widget (strace.buliscores) and pulseaudio (strace.pulseaudio). With the help of dfaure we learned from the strace log that pulseaudio was constantly sending something to fd 63 and 64..

      send(64, "\0\0\0\24\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0", 20, MSG_NOSIGNAL) = 20
      send(63, "\0\0\0\24\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0", 20, MSG_NOSIGNAL) = 20

      with the help of netstat (http://www.davidfaure.fr/kde/fd_sockets) I found out that those sockets were indeed connected to my widget.

      So pulseaudio seems to constantly send something to my widget. Next, I used gdb and a lot of ctrl+c / cont cycles to finaly get a meaningfull backtrace (backtrace_widget).

      I see that emitTick() is constantly emitted although I made sure that

      a) my widget is currently playing no sounds at all
      and
      b) not calling any phonon functions repeatedly (I would see that in a debug log otherwise)

      I think

      #12 0x4249d9dc in Phonon::Gstreamer::MediaObject::emitTick (this=0x350fa8)
      at ../../../3rdparty/phonon/gstreamer/mediaobject.cpp:1149

      is interesting, since it tells me that phonon thinks some MediaObject is still playing (which is not
      ).

      Hope that helps. If you need further info, please feel free to contact me.

      Attachments

        1. backtrace_widget
          3 kB
        2. pactl_list
          37 kB
        3. strace.buliscores
          481 kB
        4. strace.pulseaudio
          604 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bachewii Jens
            dsolbach David Solbach
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes