[Live-devel] infinite recursion
Florian Winter
fw at graphics.cs.uni-sb.de
Mon Jan 12 16:18:13 PST 2004
I have done some more testing myself. this is what I figured out:
The MultiFramedRTPSource calls its own afterGetting method *only* if it
has a complete frame.
only in this case, infinite recursion can happen. using the
testMPEG1or2Video examples, this case
never happened. the MultiFramedRTPSource::doGetNextFrame1 only had a
complete frame when it
was called by the networkReadHandler.
With the BufferedSink, things were different. Actually due to a bug in
BufferedSink, getNextFrame
was called with a buffer size of zero. The result was of course that
doGetNextFrame1 always had a full frame
and thus always called afterGetting(this), which led to the infinite
recursion.
After fixing the bug in my own code, it seemed to work again. However I
wanted to be sure if it is still
possible (for example if a certain race condition is met) that
doGetNextFrame1 can have a full frame when
it was called from continuePlaying. I figured out that this *can* happen
if the buffer size is small enough
(I tested it with a ridiculously small value of 12 bytes).
It seems that even with more reasonable buffer sizes, the "bad case" can
happen. but because it happens only rarely,
no one will notice, because the stack won't overflow. I measured the
recursion depth of the continuePlaying method.
on my system the average recursion depth with a buffer size of 120 bytes
is around 7 ;)
I think this is a bug. at least, afterGetting should not be called
directly, if doGetNextFrame1 was not called from
the networkReadHandler.
Florian Winter wrote:
> my question now is:
> am I doing something wrong, or is this a bug in FileSink or
> MultiFramedRTPSource?
More information about the live-devel
mailing list