Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Receivers and threads (was: Re: Re: Streamdev 0.0.2 problem)



Jan Ekholm wrote:
> 
> On Tue, 6 May 2003, Klaus Schmidinger wrote:
> 
> >Any cReceiver attached to a cDevice is expected to accept the data
> >provided in the Receive() call *IMMEDIATELY* and with as little delay as
> >possible. If one cReceiver takes too long here it will slow down the
> >whole process and eventually cause the data stream to break for others,
> >too. There is no way VDR can buffer this, it's up to the individual
> >cReceiver to buffer the data if it can't handle it immediately.
> 
> So the solution is to use a cThread for this as the plugin manual
> suggests. But what about the data that the cReceiver gets? This snippet
> from the plugin manual:
> 
> void cMyReceiver::Receive(uchar *Data, int Length)
> {
>   // buffer the data for processing in a separate thread
> }
> 
> Should the receiver copy the data or can it just buffer the Data pointer
> for later processing by the thread?

It has to copy the data. Take a look at how VDR does this in recorder.c.

> As for threads, what is the recommended way to start a thread? The
> alternatives as far I can see are:
> 
>         cThread::StartThread(myThread)
> and
>         myThread->Start();

cThread::StartThread() is private, so you always have to use Start().

> And then override cThread::Action() to start the actual data processing in
> the thread?
>
> Any hints? Is there a simplistic plugin that uses threads that I could
> have a look at?

Just look at the other places where VDR uses this.

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index