> Thank you for your answer, you right, I modify data source class and, I
> think, problem solved.
>
> Class Frame is sublass FramedSource.
> void Frame::doGetNextFrame()
> {
> fFrameSize = 0;
> fNumTruncatedBytes = 0;
>
> get data code
>
> if (fFrameSize)
> FramedSource::afterGetting(this);
> else
> doGetNextFrame();
>
> }
>
> But I not sure what this method optimal.
The problem with this is that you're making (potentially) infinite recursive
calls. If the next frame doesn't become available 'soon', you'll overflow the
call stack. It'd be better to turn this into a loop - i.e.:
void Frame::doGetNextFrame()
{
fFrameSize = 0;
fNumTruncatedBytes = 0;
do {
get data code
} while (fFrameSize == 0);
FramedSource::afterGetting(this);
}
But even this is suboptimal, because it chews up CPU time (in the loop) when no
frame is available. During that time, you won't be returning to the event loop
to handle other events. It'd be better to do asynchronous I/O, e.g, as
illustrated in our "DeviceSource.cpp" example code.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel