[Live-devel] (no subject)

Bob Koninckx bob.koninckx at gmail.com
Mon Sep 24 23:45:30 PDT 2007


Hi guys, thanks for all your help. Just for your information, I solved
it like this, and it works perfect for me, just wondering if there are
more elegant solutions, though.

Derived my own specialised taskscheduler from BasicTaskScheduler wich
implements its event loop like this

void
NucleusTaskScheduler::doEventLoop( char * watchVariable, unsigned
maxDelay )
{
    //
    // Schedule the command handler before actually starting up the
eventLoop
    //
    TaskFunc * taskfunc = reinterpret_cast< TaskFunc *
>( &NucleusTaskScheduler::sCommandHandler );
    m_commandhandler = scheduleDelayedTask( 0, taskfunc, this );

    while (1) {
        if (watchVariable != NULL && *watchVariable != 0) break;
        SingleStep( maxDelay );
    }

    unscheduleDelayedTask( m_commandhandler );
}

In addition, I added a thread safe command queue (an
ACE_Activation_Queue, for those who are familiar with ACE) which the
handler checks and empties every time it is scheduled. Now I can send
asynchronous requests from any thread to start/stop streaming without
leaving Live555's event loop and with guarantees that things are
scheduled when they should.  

Bob

On Mon, 2007-09-24 at 14:45 -0700, Ross Finlayson wrote:
> > Now my problem is: where and how do I get these lines to be
> > executed ?
> > startPlaying is called right before starting up Live555's event
> > loop.
> > But then my main thread is just looping forever in
> > scheduler->doEventLoop();
> 
> 
> Yes, because "LIVE555 Streaming Media" applications are event-driven
> (i.e., from within an event loop).  Therefore, you need to trigger
> your code using an event.
> 
> 
> The easiest way to do this is using a 'watch variable', as described
> in
>         http://www.live555.com/liveMedia/faq.html#exiting-event-loop
> -- 
> 
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel



More information about the live-devel mailing list