|
1 The RTP libraries |
|
2 --------------------- |
|
3 |
|
4 RTP Buffers |
|
5 ----------- |
|
6 The real time protocol as described in RFC 3550 requires the use of special |
|
7 packets containing an additional RTP header of at least 12 bytes. GStreamer |
|
8 provides some helper functions for creating and parsing these RTP headers. |
|
9 The result is a normal #GstBuffer with an additional RTP header. |
|
10 |
|
11 RTP buffers are usually created with gst_rtp_buffer_new_allocate() or |
|
12 gst_rtp_buffer_new_allocate_len(). These functions create buffers with a |
|
13 preallocated space of memory. It will also ensure that enough memory |
|
14 is allocated for the RTP header. The first function is used when the payload |
|
15 size is known. gst_rtp_buffer_new_allocate_len() should be used when the size |
|
16 of the whole RTP buffer (RTP header + payload) is known. |
|
17 |
|
18 When receiving RTP buffers from a network, gst_rtp_buffer_new_take_data() |
|
19 should be used when the user would like to parse that RTP packet. (TODO Ask |
|
20 Wim what the real purpose of this function is as it seems to simply create a |
|
21 duplicate GstBuffer with the same data as the previous one). The |
|
22 function will create a new RTP buffer with the given data as the whole RTP |
|
23 packet. Alternatively, gst_rtp_buffer_new_copy_data() can be used if the user |
|
24 wishes to make a copy of the data before using it in the new RTP buffer. An |
|
25 important function is gst_rtp_buffer_validate() that is used to verify that |
|
26 the buffer a well formed RTP buffer. |
|
27 |
|
28 It is now possible to use all the gst_rtp_buffer_get_*() or |
|
29 gst_rtp_buffer_set_*() functions to read or write the different parts of the |
|
30 RTP header such as the payload type, the sequence number or the RTP |
|
31 timestamp. The use can also retreive a pointer to the actual RTP payload data |
|
32 using the gst_rtp_buffer_get_payload() function. |
|
33 |
|
34 RTP Base Payloader Class (GstBaseRTPPayload) |
|
35 -------------------------------------------- |
|
36 |
|
37 All RTP payloader elements (audio or video) should derive from this class. |
|
38 |
|
39 RTP Base Audio Payloader Class (GstBaseRTPAudioPayload) |
|
40 ------------------------------------------------------- |
|
41 |
|
42 This base class can be tested through it's children classes. Here is an |
|
43 example using the iLBC payloader (frame based). |
|
44 |
|
45 For 20ms mode : |
|
46 |
|
47 GST_DEBUG="basertpaudiopayload:5" gst-launch-0.10 fakesrc sizetype=2 |
|
48 sizemax=114 datarate=1900 ! audio/x-iLBC, mode=20 ! rtpilbcpay |
|
49 max-ptime="40000000" ! fakesink |
|
50 |
|
51 For 30ms mode : |
|
52 |
|
53 GST_DEBUG="basertpaudiopayload:5" gst-launch-0.10 fakesrc sizetype=2 |
|
54 sizemax=150 datarate=1662 ! audio/x-iLBC, mode=30 ! rtpilbcpay |
|
55 max-ptime="60000000" ! fakesink |
|
56 |
|
57 Here is an example using the uLaw payloader (sample based). |
|
58 |
|
59 GST_DEBUG="basertpaudiopayload:5" gst-launch-0.10 fakesrc sizetype=2 |
|
60 sizemax=150 datarate=8000 ! audio/x-mulaw ! rtppcmupay max-ptime="6000000" ! |
|
61 fakesink |
|
62 |
|
63 RTP Base Depayloader Class (GstBaseRTPDepayload) |
|
64 ------------------------------------------------ |
|
65 |
|
66 All RTP depayloader elements (audio or video) should derive from this class. |