Class: RTCP::SDES
Overview
SDES: Source Description RTCP Packet Documentation: RFC 3550, 6.5
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
header |V=2|P| SC | PT=SDES=202 | length |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
chunk | SSRC/CSRC_1 |
1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SDES items |
| ... |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
chunk | SSRC/CSRC_2 |
2 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SDES items |
| ... |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Constant Summary collapse
- PT_ID =
202
- SDES_CHUNK_TYPES =
{ 1 => :cname, 2 => :name, 3 => :email, 4 => :phone, 5 => :loc, 6 => :tool, 7 => :note, 8 => :priv }
Constants inherited from RTCP
Instance Attribute Summary collapse
-
#chunks ⇒ Object
readonly
Returns the value of attribute chunks.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Attributes inherited from RTCP
Instance Method Summary collapse
Methods inherited from RTCP
Instance Attribute Details
#chunks ⇒ Object (readonly)
Returns the value of attribute chunks.
35 36 37 |
# File 'lib/rtcp/sdes.rb', line 35 def chunks @chunks end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
35 36 37 |
# File 'lib/rtcp/sdes.rb', line 35 def version @version end |
Instance Method Details
#decode(packet_data) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/rtcp/sdes.rb', line 37 def decode(packet_data) vprc, packet_type, length = packet_data.unpack('CCn') ensure_packet_type(packet_type) @length = 4 * (length + 1) @version = vprc >> 6 count = vprc & 15 loop_length = @length sdes_data = payload_data(packet_data, @length, 4) loop_length -= 4 chunks = [] for i in 0..count-1 ssrc, payload = sdes_data.unpack('Na*') loop_length -= 4 sdes_items = [] while loop_length > 0 type_id, payload = payload.unpack('Ca*') loop_length -= 1 break if type_id == 0 len, payload = payload.unpack("Ca*") val, payload = payload.unpack("a#{len}a*") type = SDES_CHUNK_TYPES[type_id] || type_id sdes_items.push({ type: type, data: val, length: len }) loop_length -= (2 + len) end chunks.push( { ssrc: ssrc, sdes_items: sdes_items }) end @chunks = chunks self end |