Chapter 6. The Output Module

Table of Contents
The Module itself
The internal Fifo

The Output Module takes the data from the TsStreamer, gather the TS packets together and add RTP header when needed, and then writes the datas to a file of to the network. Refer to General architecture to see the position of Output between other parts of vls.

The Module itself

As other modules of vls, a core file server/output.* describes the definition of the output, and its behavior against others parts of vls. The modules NetOutput and FileOutput differs from their implementation of the virtual function WriteToPort().

The Output is created by the Channel Module. In modules/filechannel.cpp :

  m_pOutput = new C_FileOutput(strFilename, bAppend);
and in modules/netchannel.cpp:
    m_pOutput = new C_Net4Output(m_strName);

The internal Fifo

Since the output may have to gather packets, it needs a Fifo of TsPackets. Its name is m_cBuffer(). The capacity (ie the maximum size) of m_cBuffer() is specified in the Output constructor :

C_Output::C_Output(unsigned int iBuffSize) : m_cTsBuff(iBuffSize)

In the case of FileOutput, the vls can write the packet when he wants, to we don't care about the number of packets written. iBuffSize can be 1, or 7 if we want to store 7 TsPackets in an RTP packet when using RTP.

In the case of NetOutput, this is more important since this will influence the size of each UDP packets. The maximum amount is 7. Indeed, the maximum payload size for an UDP packet is 1472 Bytes. Each TsPacket is 188 Bytes, and 1472/188 = 7.

Moreover, when using RTP output, 12 extra header bytes are added. But it's still ok since :

7 * 188 + 12 = 1328 < 1472.

By default, the TS_IN_ETHER value defined in server/output.h is set to 7. You may change that depending on how your network hardware can handle big UDP packets.