rtp.c File Reference

Functions to handle RTP headers and packets per RFC 3984 with restricted functionality. More...

#include <netinet/in.h>
#include "global.h"
#include "rtp.h"
#include "sei.h"

Include dependency graph for rtp.c:

Go to the source code of this file.

Defines

#define SYMTRACESTRING(s)

Functions

int ComposeRTPPacket (RTPpacket_t *p)
int WriteRTPPacket (RTPpacket_t *p, FILE *f)
int WriteRTPNALU (ImageParameters *p_Img, NALU_t *n)
void RTPUpdateTimestamp (ImageParameters *p_Img, int tr)
void OpenRTPFile (ImageParameters *p_Img, char *Filename)
void CloseRTPFile (ImageParameters *p_Img)


Detailed Description

Functions to handle RTP headers and packets per RFC 3984 with restricted functionality.

Author:
Stephan Wenger stewe@cs.tu-berlin.de

Definition in file rtp.c.


Function Documentation

void CloseRTPFile ( ImageParameters p_Img  ) 

Closes the output file for the RTP packet stream.

Returns:
none. Function terminates the program in case of an error

Definition at line 320 of file rtp.c.

Referenced by terminate_sequence().

int ComposeRTPPacket ( RTPpacket_t *  p  ) 

ComposeRTPpacket composes the complete RTP packet using the various structure members of the RTPpacket_t structure.

Returns:
0 in case of success negative error code in case of failure
Parameters
Caller is responsible to allocate enough memory for the generated packet in parameter->packet. Typically a malloc of 12+paylen bytes is sufficient
Side effects
none
Note:
Function contains assert() tests for debug purposes (consistency checks for RTP header fields
Date:
30 September 2001
Author:
Stephan Wenger stewe@cs.tu-berlin.de

Definition at line 60 of file rtp.c.

Referenced by WriteRTPNALU().

void OpenRTPFile ( ImageParameters p_Img,
char *  Filename 
)

Opens the output file for the RTP packet stream.

Parameters:
p_Img Image parameters for current picture encoding
Filename The filename of the file to be opened
Returns:
none. Function terminates the program in case of an error

Definition at line 299 of file rtp.c.

Referenced by start_sequence().

void RTPUpdateTimestamp ( ImageParameters p_Img,
int  tr 
)

RTPUpdateTimestamp: patches the RTP timestamp depending on the TR.

Parameters:
p_Img Image parameters for current picture encoding
tr tr: TRof the following NALUs
Returns:
none.

This is a violation of the security req. of

RTP (random timestamp), but easier to debug

The following code assumes a wrap around of TR at 256, and needs to be changed as soon as this is no more true.

The support for B frames is a bit tricky, because it is not easy to distinguish between a natural wrap-around of the tr, and the intentional going back of the tr because of a B frame. It is solved here by a heuristic means: It is assumed that B frames are never "older" than 10 tr ticks. Everything higher than 10 is considered a wrap around.

Definition at line 250 of file rtp.c.

References img_par::CurrentRTPTimestamp, and RTP_TR_TIMESTAMP_MULT.

Referenced by start_slice().

int WriteRTPNALU ( ImageParameters p_Img,
NALU_t n 
)

int RTPWriteNALU write a NALU to the RTP file

Returns:
Number of bytes written to output file
Side effects
Packet written, RTPSequenceNumber and RTPTimestamp updated
Date:
December 13, 2002
Author:
Stephan Wenger stewe@cs.tu-berlin.de

For error resilience work, we need the correct marker bit. Introduce a nalu->marker and set it in terminate_slice()?

Definition at line 173 of file rtp.c.

References nalu_t::buf, ComposeRTPPacket(), img_par::CurrentRTPSequenceNumber, img_par::CurrentRTPTimestamp, nalu_t::forbidden_bit, H264PAYLOADTYPE, H264SSRC, nalu_t::len, MAXRTPPACKETSIZE, nalu_t::nal_reference_idc, nalu_t::nal_unit_type, no_mem_exit(), nalu_t::startcodeprefix_len, and WriteRTPPacket().

Referenced by start_sequence().

Here is the call graph for this function:

int WriteRTPPacket ( RTPpacket_t *  p,
FILE *  f 
)

WriteRTPPacket writes the supplied RTP packet to the output file.

Returns:
0 in case of access <0 in case of write failure (typically fatal)
Parameters:
p the RTP packet to be written (after ComposeRTPPacket() )
f output file
Date:
October 23, 2001
Author:
Stephan Wenger stewe@cs.tu-berlin.de

Definition at line 131 of file rtp.c.

Referenced by WriteRTPNALU().


Documentation generated with DoxyGen