# the following code makes popcorn.Player deadlocked:

import kaa
from kaa import popcorn
player=popcorn.Player()

audio1="/home/tpfly/audio/06hh.wma"

@kaa.coroutine()
def test():
    yield player.open(audio1,player="mplayer")
    player.pause()               # this line causes the problem
    print "starting playback..."
    yield player.play()
    player.resume()
    print "enjoy the music......"
    yield kaa.delay(10)
    yield player.stop()
    print "player stopped"

test()
kaa.main.run()

# end

Calling player.pause() before player.play() causes the play inprogress
won't finish and the playback won't start,
and the mplayer process won't start either.

Maybe we should prevent from calling the methods in this sequence, but
the events usually come from user interface, one could occasionally
press pause button before playback starts, and I think it's the
player's responsibility to keep reliable and robust.

The problem is in generic.py, in decorator required_states:

            if self._get_state() in states and not self._pending:
                # already finished
                return kaa.InProgress().execute(func, self, *args, **kwargs)
            # add callback to list of pending calls
            async = kaa.InProgress()
            callback = kaa.Callable(func, self, *args, **kwargs)
            self._pending.append((states, async, callback))
            return async

when calling play(), self._get_state() is already STATE_OPEN, but
there is a pending operation 'pause' in self._pending waiting
STATE_PLAY or STATE_PAUSED, so the play operation is added to
self._pending too and will never play anything.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to