[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Phonon::MediaObject::setCurrentSource() sometimes hangs
From:       Nikos Chantziaras <realnc () arcor ! de>
Date:       2010-03-07 12:11:26
Message-ID: hn054v$12o$1 () dough ! gmane ! org
[Download RAW message or body]

I apologize if this the wrong mailing list.  I was a bit confused as to 
where to post Phonon-related questions.  I'm not developing KDE 
applications, but I'm using KDE's Phonon, not Qt's, so I guess this 
belongs here.  Correct me if I'm wrong :P

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.

Everything works fine if I instead save file.read(size) into a new QFile 
and pass its fileName() to setCurrentSource().  However, in both cases, 
file.read(size) contains the exact same data.

Any hints as to what's going on?

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic