Download presentation
Presentation is loading. Please wait.
1
Speaker:Ying-shun Date:2006/11/27
RTP Library Speaker:Ying-shun Date:2006/11/27
2
Outline Organization of files Functions - Examples Sample demo
References
3
Organization of the files (1/2)
The project is composed of ten files - RTP.c:Sources of the functions of the bookshop. Functions intended for the users of the bookshop - RTP.h:Contains the total structures of the project - Config.h :It contains the symbols of the bookshop - Proto.h:Prototypes of all the functions of the project - Network.c:Sources of functions networks of the bookshop
4
Organization of the files (2/2)
- Network.h:Structures networks of the bookshop - Hdr_Builder.c :Sources of the functions used for the construction of heading RTP. - Macros.h:All the macros project contains - Types.h:Declaration of the types specific to the bookshop
5
RTP header
6
Functions(1) Init_Socket(void); int Close_Socket(void);
- Initialize the use of the socket int Close_Socket(void); - Close the use of the socket
7
Functions(2) int RTP_Create(context *the_context)
- This function creates a context and adds to the list of the contexts. - A context is a structure containing all the variables of session related to the data flow transmitted by the means of protocol RTP - The RTP_Create function () assigns to the pointer the_context the number context in the list . EX: context_list [4] - >pt = 0
8
Structure of context typedef struct {
int context_num; /* Number of context - sending/ reception */ u_int my_ssrc; /* Number SSRC - sending/ reception */ u_int sending_pkt_count; /* A number of packages sent - sending/ reception */ u_int sending_octet_count; /* A number of bytes sent sending reception */ u_int version; /* Version of the protocol - reception */ u_int marker; /* Marker flag - reception */ u_int padding; /* Length of the padding - reception */ u_int CSRClen; /* A number of elements CSRC - sending/reception */ u_int pt; /* Type of Payload - sending/ reception */ u_int *CSRCList; /* List CSRC sending reception */ u_int my_previous_ssrc; /* Currently not used */ u_int init_RTP_timestamp; /* Initial value of the timestamp - sending/reception */ u_int RTP_timestamp; /* Current value of the timestamp - reception */ u_int time_elapsed; /* Time passed since the sending beginning reception */ u_int init_seq_no; /* Initial number of sequence - sending reception */ u_int seq_no; /* Current number of sequence - sending/ reception */ rtp_ext *hdr_extension; /* Extension of the heading - sending/ reception */ void *conx_data; /* Data networks */ } sess_context_t;
9
Functions(3) int RTP_Destroy (context cid)
- Destroyed the context thus the number is indicated by cid. u_int32 Get_Period_us(u_int8 pt) - Get the period of incrementing of the timestamp according to the type of payload.
10
Functions(4) int RTP_Add_Send_Addr (context cid, tank *addr, u_int16 port, u_int8 ttl) - Add a recipient to for the next sendings of packages. cid:Number of the context obtained using the RTP_Create function (). addr:Address IP of the target machine. port:Port of the target machine. ttl : Time To Life
11
Functions(5) int RTP_Send(context cid, u_int32 tsinc, u_int8 marker, u_int16 pti, u_int8 *payload, int len) - Add heading RTP to a package and sends it to all the recipients of the list . cid : Number of the context obtained using the RTP_Create function (). tsinc : Value whose timestamp must be incremented. marker : Value of the flag marker. pti: Type of payload. payload: Contents of the package to be sent. len : Length of the package to be sent.
12
Example 1 Run Rtp_Example_Send Use ethereal to observe RTP package
13
Functions(6) int RTP_Receive(context cid, int fd, char *payload, int *len, struct sockaddr *sin) - Parse package RTP to extract heading RTP, and assigns the value to the Context structure.Turn over (0) if heading RTP could not be parser, if not turns over (1) if the operation it passed well cid : Structure context of RTP, who must be initialized with the RTP_create function (), and destroyed with RTP_destroy (). fd : Indentifiant of the socket. payload : Contents of the received package. len : Cut payload. sin :Contents of information of the connection of the customer.
14
Example 2 Run Rtp_Example_Receiver
Observe the package information received in receiver Fetch the information of payload to payload.txt
15
Sample demo Sender uses RTP package to convey test.wav to receiver
Fetch the information(binary) of payload to payload.wav
16
References http://burns79.free.fr/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.