[Live-devel] Live555 Streaming from a live source
Ross Finlayson
finlayson at live555.com
Thu Jul 8 22:44:40 PDT 2010
>We are trying to stream from a live source with Live555.
>We implement our own DeviceSource class. In this class we implement
>doGetNextFrame in the following (logic) way. We remove all the
>unnecessary implementation details so you can see the idea
>
>If no frame is available do the following
>
> nextTask() =
>envir().taskScheduler().scheduleDelayedTask(30000,(TaskFunc*)nextTime,
>this);
>If a frame is available do the following
>
>If (fFrameSize < fMaxSize)
This should be "<=", not "<".
Also, I hope you are setting "fFrameSize" properly before you get to
this "if" statement.
>{
>memcpy(fTo, Buffer_getUserPtr(hEncBuf) ,fFrameSize); // copy the
>frame to Live555
>nextTask() =
>envir().taskScheduler().scheduleDelayedTask(0,(TaskFunc*)FramedSource::afterGetting,
>this);
You can probably replace this last statement with:
FramedSource::afterGetting(this);
which is more efficient (and will avoid infinite recursion, because
you're reading from a live source).
>}
>else
>{
>What should we do? (We do not understand what should we do in this option)
Something like this:
fNumTruncatedBytes = fFrameSize - fMaxSize;
fFrameSize = fMaxSize;
FramedSource::afterGetting(this);
Note, however, that if data gets truncated, then it is *dropped*.
This means that you should make sure that your downstream object
always has enough buffer space to avoid trunction - i.e., so that
fMaxSize is always >= fFrameSize
--
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list