[Live-devel] MultiFramedRTPSink flush collected packet

Ross Finlayson finlayson at live555.com
Thu Aug 30 06:14:30 PDT 2012


> I am using SimpleRTPSink with my frame source (based on FramedSource).

By this I hope you mean "a subclass of FramedSource".


> The frame may be small, so SimpleRTPSink packs several frames into a single packet. That's right, I wish it to do so. I have nevertheless troubles to realize, how to make SimpleRTPSink flush its packets in a time manner, after for example the first frame of a packet has 10ms overdue time. Is there an easy way to achieve sending the not-yet-full packets in time?

Yes, you should be able to do this by using a subclass (that you would write) of "SimpleRTPSink", and reimplement the virtual function
	virtual Boolean frameCanAppearAfterPacketStart(unsigned char const* frameStart, unsigned numBytesInFrame) const;

This function is called whenever a frame is small enough to fit within an outgoing packet, at other the first position within the frame.  By default (in "SimpleRTPSink") this function returns True (because you have presumably created "SimpleRTPSink" with the "allowMultipleFramesPerPacket" parameter set to True (its default value).  However, you can redefine this function - in your "SimpleRTPSink" subclass - to return either True or False, depending on whether or not you want to include this frame in this outgoing packet.

Now, because "frameCanAppearAfterPacketStart()" is called only for the (potentially) second and subsequent frames within each outgoing packet, you probably don't have enough information to make your decision just by subclassing that function.  So you will probably also need to redefine another virtual function - "doSpecialFrameHandling()".  That function is called for each frame - regardless of its position within the outgoing packet.  You'll probably need to redefine that function - in particular, noting the "fragmentationOffset" parameter.  If that parameter is 0, then the frame is the first frame in the outgoing packet; otherwise, it's the second or subsequent frame within the packet.  Of course, your subclass's implementation of "doSpecialFrameHandling()" will need to call the base class implementation - i.e.
	SimpleRTPSink::doSpecialFrameHandling( ... )
at the end.


> I think of calling MultiFramedRTPSink::sendPacketIfNecessary() on timer

Absolutely not!  And you should not even have considered doing this, because that function is "private:", and you know that you're not supposed to modify the supplied code.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120830/da1e7d53/attachment.html>


More information about the live-devel mailing list