[Live-devel] Meaning of member variables in FramedSource class

Mehran Ansari mehran at stretchinc.com
Mon Oct 18 10:17:38 PDT 2010


As I was reading the source code in Live555, I see that FramedSource class is a class that is very important to learn and understand specially if you are implementing a your own streaming class such as H.264 Live streaming.

This subclass is meant to provide video frames (in my case h.264 video frame provided by my encoder) is derived from H264VideoStramFramer which is derived from FrameFilter and that is derived from FrameSource.

First you must implement doGetNextFrame() virtual method which will be called every time a new frame needs to be sent to the client. Then my understanding from the FrameSource class is that the following member variables must be set when doGetNextFrame() is called but before calling afterGetting() method. Also I understand the afterGetting() schedules a time for doGetNextFrame() to be called again.
 
- fTo - Is a buffer provided by the Live555 where I have to copy the lasted video frame provided by my encoder to it
- fMaxSize - Is the maximum number of bytes that can be written to fTo buffer
- fFrameSize - Is the number of Bytes that my class wrote in to fTo
- fNumTruncatedBytes - If fMaxSize is less than my encoded video frame buffer, then, it indicates how many more bytes are still needed to be written to fTo next time when doGetNextFrame() is called again 
- fPresentationTime - Needs to be set by me. What is this time? Is this required?  My encoder provide a relative time which is number of ticks since some original. Do I have to translate that to the real unix time? Or can I just keep the number of relative ticks. What happens if this field is set to zero? or not set at all
- fDurationInMicroseconds - Needs to be set by me. Again is this required? What happens if this field is set to zero? or not set at all. What do I set this for buffer for frames such as SPS or PPS?

What is the purpose of virtual method isFramedSource()? 

What is the purpose of virtual method maxFrameSize()? and how does this relate to OutPacketBuffer::maxSize

What is the purpose of virtual method doStopGettingFrames()? 

Thanks for your help in clarifying my understanding which can be very helpful for many new users of this library.


More information about the live-devel mailing list