| Valkka
    1.6.1
    OpenSource Video Management | 
Some notes on receiving/sending live streams
From the point of view of API users, sending frames happens simply by connecting a source to LiveFifo (see the examples). Behind the scene, frames are sent over the net, by calling LiveFifo::writeCopy - i.e. using the unified approach in Valkka library to handle frames; they are handled in the same way, whether they are passed to the decoder or sent to the screen by using OpenGLFrameFifo (see Library architecture).
Sending frames happens roughly as follows:
Streams sent directly to UDP ports, as defined in an SDP file ("SDP" streams)
buffer_source =new BufferSource(env, fifo, 0, 0, 4); // nalstamp offset: 4 terminal =H264VideoStreamDiscreteFramer::createNew(env, buffer_source); sink = H264VideoRTPSink::createNew(env,rtpGroupsock, 96); sink->startPlaying(*(terminal), this->afterPlaying, this);
Frames flow like this: BufferSource => H264VideoStreamDiscreteFramer => H264VideoRTPSink
This diagram, where "{}" means enclosing object will help you to understand this:
BufferSource (.., fifo) {
   - Live555 FramedSource class with method "doGetNextFrame"
   - Recycles frames back to fifo (in doGetNextFrame)
}
Stream {
   RTPSink,
   RTCPInstance,
   Groupsock,
   BufferSource *buffer_source,
   FrameFifo &fifo,
   
   methods:
       startPlaying
           - issues startPlaying on the live555 
             event loop (for the internal live555 
             filterchain defined in the Stream subclasses)
       afterPlaying
           - a live555 callback
}
H264 : public Stream {
   - Instantiates buffer_source = new BufferSource (.., fifo)
   - Creates the live555 internal filterchain
}
Some misc. observations / code walkthrough:
To get this into one's head, let's take a look at this diagram. "{}" means enclosing object:
RTSPServer {
   H264ServerMediaSubsession {
       - member "fifo" is a reference to FrameFifo
   
       - method : createNewStreamSource
           - creates buffer_source = BufferSource (.., fifo)
           - creates H264VideoStreamDiscreteFramer(buffer_source)
           => returns to RTPServer: H264VideoStreamDiscreteFramer(buffer_source)
           
       - inherited method sdpLines
       - inherited method closeStreamSource
   }
}