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