MediaObject::setCurrentSource() hangs the application

Nikos Chantziaras realnc at arcor.de
Wed Apr 14 20:08:34 BST 2010


I've posted this to kde-devel a month ago because I wasn't aware of the 
multimedia list.  A month later, I still wasn't able to find a 
workaround for this bug, leaving the application I'm writing unusable 
with KDE+Xine.  Anyone can help with some hack/workaround?


Original post:

I've come across a weird problem with 
Phonon::MediaObject::setCurrentSource() sometimes hanging and never 
returning when used in combination with a QBuffer.  The code that hangs 
is this:


Phonon::MediaObject* getMedia(const QString& fname, int pos, int size)
{
   QFile file(fname);
   file.open(QIODevice::ReadOnly);
   file.seek(pos); // A *.wav file is embedded at that position
   Phonon::MediaObject* med = new Phonon::MediaObject(0);
   QBuffer* buf = new QBuffer(med);
   buf->setData(file.read(size)); // The embedded wav is 'size' bytes big
   Phonon::MediaSource src(buf);

   med->setCurrentSource(src);  // <-- This hangs

   return med;
}


Most of the time, the application hangs the second time the above gets 
called; med->setCurrentSource(src) never returns.  When the hang occurs, 
there's no CPU load, so I guess Phonon is waiting for something.  This 
only happens with the KDE version of Phonon, and then only if Xine is 
used as the back-end.  GStreamer doesn't have this bug.


I've prepared a small example application that will trigger the bug:

    http://foss.math.aegean.gr/~realnc/qt/phonon_bug.tar.gz

The tarball includes a small data file from which the code will try to 
load the embedded WAV files from.  Simply "qmake; make" and then run it.

I've also filed a bug about this (which includes a backtrace where the 
hang occurs), but to this day there are no replies (neither to confirm 
or to "works-for-me"):

   http://bugs.kde.org/show_bug.cgi?id=230005



More information about the kde-multimedia mailing list