[Live-devel] mpeg4 encoder

Ross Finlayson finlayson at live.com
Wed Mar 9 08:21:11 PST 2005


>I have a defective visible output on the client side, if the encoded 
>frames are bigger than fMaxSize.
>Currently I do the following in DeviceSource::deliverFrame:
>
>If the delivered frame size is bigger than fMaxSize I only copy the first 
>part of the frame to fTo (exactly fMaxSize bytes)
>Then I set fNumTruncatedBytes = TotalFrameSize - fMaxSize
>(TotalFrameSize is the size of the encoded frame)
>and fFrameSize = fMaxSize.
>and TotalFrameSize = TotalFrameSize - fMaxSize
>
>The next time the deliverFrame function is called I copy the remainder of 
>the frame to fTo,
>set fFrameSize = TotalFrameSize,
>fNumTruncatedBytes = 0

That won't work, because you are telling the consuming object (probably a 
RTPSink) that it's being delivered two separate frames, rather than just one.

Instead, you need to make sure that the consuming object has enough buffer 
size to begin with.  You can do this by setting "OutPacketBuffer::maxSize" 
to an appropriate value, *before* you create your RTPSink object.

The default value of "OutPacketBuffer::maxSize" is 60000; it seems that you 
are generating MPEG-4 frames that are larger than this size.

If, for example, you anticipate that your MPEG-4 video frames will be no 
larger than 100000 bytes, then do
         OutPacketBuffer::maxSize = 100000;
before you create your "RTPSink" object.


	Ross Finlayson
	LIVE.COM
	<http://www.live.com/>



More information about the live-devel mailing list