[Live-devel] What is the correct way to use OutPacketBuffer::increaseMaxSizeTo when fFrameSize > fMaxsize?

Matthew Czarnek mczarnek at edge360.com
Fri Jul 10 14:21:03 PDT 2020


I had a scenario where the frame was too large and the way I was handling
it caused issues.

What I would really like to do is be able to increase the size of the frame
buffer for future frames if I overrun it once. So I was calling
"OutPacketBuffer::increaseMaxSizeTo(fFrameSize);" and tried adding a little
bit too it. However, if I call this in the middle of processing a frame,
then H264or5VideoRTPSink throws an error on line 252 "Access violation
reading location"

Specifically:
I initially set OutPacketBuffer::maxSize = 600,000
A frame comes in that has a size of 616969, I
call OutPacketBuffer::increaseMaxSizeTo(616969)

The next time it hits  memmove(fTo,
&fInputBuffer[fCurDataOffset-numExtraHeaderBytes], numBytesToSend);
in H264or5VideoRTPSink there are no problems

However, when I encounter another frame larger than 600,000
specifically 601316 (so smaller than the new fMaxSize) then memmove
in H264or5VideoRTPSink will throw an exception

Is there a way to increase fMaxSize midstream?

Here is my code.  Thanks!

if (fFrameSize > fMaxSize)
{
fNumTruncatedBytes = fFrameSize - fMaxSize - offset;
//OutPacketBuffer::increaseMaxSizeTo(fFrameSize+10);
memcpy(fTo, new_byte_pointer, fMaxSize - offset);
}
else
{
memcpy(fTo, new_byte_pointer, fFrameSize - offset);
}


-- 
Matthew Czarnek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20200710/4ef402ef/attachment.htm>


More information about the live-devel mailing list