1The 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. 25 26 It is now possible to use all the gst_rtp_buffer_get_*() or 27 gst_rtp_buffer_set_*() functions to read or write the different parts of the 28 RTP header such as the payload type, the sequence number or the RTP 29 timestamp. The use can also retreive a pointer to the actual RTP payload data 30 using the gst_rtp_buffer_get_payload() function. 31 32 RTP Base Payloader Class (GstBaseRTPPayload) 33 -------------------------------------------- 34 35 All RTP payloader elements (audio or video) should derive from this class. 36 37 RTP Base Audio Payloader Class (GstBaseRTPAudioPayload) 38 ------------------------------------------------------- 39 40 This base class can be tested through it's children classes. Here is an 41 example using the iLBC payloader (frame based). 42 43 For 20ms mode : 44 45 GST_DEBUG="basertpaudiopayload:5" gst-launch-1.0 fakesrc sizetype=2 46 sizemax=114 datarate=1900 ! audio/x-iLBC, mode=20 ! rtpilbcpay 47 max-ptime="40000000" ! fakesink 48 49 For 30ms mode : 50 51 GST_DEBUG="basertpaudiopayload:5" gst-launch-1.0 fakesrc sizetype=2 52 sizemax=150 datarate=1662 ! audio/x-iLBC, mode=30 ! rtpilbcpay 53 max-ptime="60000000" ! fakesink 54 55 Here is an example using the uLaw payloader (sample based). 56 57 GST_DEBUG="basertpaudiopayload:5" gst-launch-1.0 fakesrc sizetype=2 58 sizemax=150 datarate=8000 ! audio/x-mulaw ! rtppcmupay max-ptime="6000000" ! 59 fakesink 60 61 RTP Base Depayloader Class (GstBaseRTPDepayload) 62 ------------------------------------------------ 63 64 All RTP depayloader elements (audio or video) should derive from this class. 65