Phonon MediaObject's aboutToFinish() and phonon-vlc

Mark Kretschmann kretschmann at kde.org
Wed Oct 13 15:25:55 CEST 2010


On Wed, Oct 13, 2010 at 8:52 AM, Harald Sitter <sitter.harald at gmail.com> wrote:
> Dearest Amarok Team,
>
> Yesterday we had a bit of a bug hunt in #phonon and came to find the
> cause of Amarok randomly stopping playback. The good news first: we
> found the cause and have a sort-of workaround in phonon-vlc's git.
>
> However.
>
> The actual cause is a behaviour on your side that we do not consider a
> very good idea. Your EngineController only will enqueue the next track
> in the playlist when the Phonon MediaObject emits its aboutToFinish()
> signal. This has two major disadvantages.
> a) aforementioned signal can only be reliably emitted when the track
> length is known (not the case for webstreams and of course if the
> underlying library cannot reliably detect the length)
> b) even though the documentation of Phonon says that the signal is
> emitted reasonable time before the track ends, so that you can enqueue
> a new track. That is however also not true if the track length is not
> known or detected in a wrong way and you still anticipate the signal
> to be fired.
>
> So, to put that into a bit of context. The problem with phonon-vlc is
> actually spanning across multiple levels.
> 1. VLC detects a wrong track length for certain OGG files, if someone
> needs a test file, please poke me on IRC
> 2. Phonon-VLC does not emit aboutToFinish() if the track playback ends
> at an unknown time.
> 3. Amarok depends on aboutToFinish() to be emitted in order to
> progress in the playback.
>
> jb is apparently working on 1., 2. we fixed by making sure
> aboutToFinish() is emitted before finished() if not emitted yet, 3.
> still needs fixing though.
>
> From our POV you should not wait for aboutToFinish() but set an
> equallity between aboutToFinish() and finished() (latter of course
> only if former was not received already). Consider the following case:
> *) user plays webstream
> *) webstream fails (connection lost)
> *) backend emits finished (taking the documentation literally
> aboutToFinish should only be emitted when the backend can give enough
> time to enqueue a new track
> *) amarok continues in playlist
>
> This behaviour can however only be archived reliably if you accept
> finished() as possibly premature end and treat it as such.
>
> Additionally I would like to mention that the workaround we use right
> now, makes the contextview switch to the "I am not playing no nothing"
> mode, presumably because Amarok intreprets the finished() as such
> regardless of whether a new track is already on the way.
>
> I hope this all makes sense considering I wrote it while sitting in
> calculus class ^^

Thanks Harald! Your work on Phonon and Amarok's Phonon interface is
very welcome.

Just a short note (I'm still at Qt Dev Days, short on time):

Ralf Engels is currently working a huge refactoring of our (crufty)
EngineController. His patch should simplify our code and resolve many
bugs. Ralf will probably be interested in your tips, so I'm CC'ing
him,

Cheers, Mark.

-- 
Mark Kretschmann
Amarok Developer
Fellow of the Free Software Foundation Europe
http://amarok.kde.org - http://www.fsfe.org


More information about the Amarok-devel mailing list