rtcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/README.rdoc +79 -0
- data/Rakefile +8 -0
- data/lib/rtcp.rb +99 -0
- data/lib/rtcp/app.rb +36 -0
- data/lib/rtcp/bye.rb +48 -0
- data/lib/rtcp/decode_error.rb +4 -0
- data/lib/rtcp/psfb.rb +55 -0
- data/lib/rtcp/rr.rb +45 -0
- data/lib/rtcp/rsi.rb +82 -0
- data/lib/rtcp/sdes.rb +77 -0
- data/lib/rtcp/sr.rb +86 -0
- data/lib/rtcp/version.rb +4 -0
- data/lib/rtcp/xr.rb +170 -0
- data/rtcp.gemspec +25 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/support/test_descriptions.rb +124 -0
- data/spec/unit/rtcp/app_spec.rb +26 -0
- data/spec/unit/rtcp/bye_spec.rb +25 -0
- data/spec/unit/rtcp/psfb_spec.rb +25 -0
- data/spec/unit/rtcp/rr_spec.rb +59 -0
- data/spec/unit/rtcp/rsi_spec.rb +28 -0
- data/spec/unit/rtcp/sdes_spec.rb +44 -0
- data/spec/unit/rtcp/sr_spec.rb +62 -0
- data/spec/unit/rtcp/xr_spec.rb +95 -0
- data/spec/unit/rtcp_spec.rb +43 -0
- metadata +137 -0
data/lib/rtcp/sdes.rb
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# SDES: Source Description RTCP Packet
|
|
2
|
+
# Documentation: RFC 3550, 6.5
|
|
3
|
+
#
|
|
4
|
+
# 0 1 2 3
|
|
5
|
+
# 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
|
|
6
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
7
|
+
# header |V=2|P| SC | PT=SDES=202 | length |
|
|
8
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
9
|
+
# chunk | SSRC/CSRC_1 |
|
|
10
|
+
# 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
11
|
+
# | SDES items |
|
|
12
|
+
# | ... |
|
|
13
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
14
|
+
# chunk | SSRC/CSRC_2 |
|
|
15
|
+
# 2 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
16
|
+
# | SDES items |
|
|
17
|
+
# | ... |
|
|
18
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
19
|
+
|
|
20
|
+
class RTCP::SDES < RTCP
|
|
21
|
+
|
|
22
|
+
PT_ID = 202
|
|
23
|
+
|
|
24
|
+
SDES_CHUNK_TYPES = {
|
|
25
|
+
1 => :cname,
|
|
26
|
+
2 => :name,
|
|
27
|
+
3 => :email,
|
|
28
|
+
4 => :phone,
|
|
29
|
+
5 => :loc,
|
|
30
|
+
6 => :tool,
|
|
31
|
+
7 => :note,
|
|
32
|
+
8 => :priv
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
attr_reader :version, :chunks
|
|
36
|
+
|
|
37
|
+
def decode(packet_data)
|
|
38
|
+
vprc, packet_type, length = packet_data.unpack('CCn')
|
|
39
|
+
ensure_packet_type(packet_type)
|
|
40
|
+
|
|
41
|
+
@length = 4 * (length + 1)
|
|
42
|
+
@version = vprc >> 6
|
|
43
|
+
count = vprc & 15
|
|
44
|
+
loop_length = @length
|
|
45
|
+
sdes_data = payload_data(packet_data, @length, 4)
|
|
46
|
+
loop_length -= 4
|
|
47
|
+
chunks = []
|
|
48
|
+
for i in 0..count-1
|
|
49
|
+
ssrc, payload = sdes_data.unpack('Na*')
|
|
50
|
+
loop_length -= 4
|
|
51
|
+
sdes_items = []
|
|
52
|
+
while loop_length > 0
|
|
53
|
+
type_id, payload = payload.unpack('Ca*')
|
|
54
|
+
loop_length -= 1
|
|
55
|
+
break if type_id == 0
|
|
56
|
+
|
|
57
|
+
len, payload = payload.unpack("Ca*")
|
|
58
|
+
val, payload = payload.unpack("a#{len}a*")
|
|
59
|
+
type = SDES_CHUNK_TYPES[type_id] || type_id
|
|
60
|
+
sdes_items.push({
|
|
61
|
+
type: type,
|
|
62
|
+
data: val,
|
|
63
|
+
length: len
|
|
64
|
+
})
|
|
65
|
+
loop_length -= (2 + len)
|
|
66
|
+
end
|
|
67
|
+
chunks.push(
|
|
68
|
+
{
|
|
69
|
+
ssrc: ssrc,
|
|
70
|
+
sdes_items: sdes_items
|
|
71
|
+
})
|
|
72
|
+
end
|
|
73
|
+
@chunks = chunks
|
|
74
|
+
self
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
data/lib/rtcp/sr.rb
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# SR: Sender Report RTCP Packet
|
|
2
|
+
# Documentation: RFC 3550, 6.4.1
|
|
3
|
+
#
|
|
4
|
+
# 0 1 2 3
|
|
5
|
+
# 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
|
|
6
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
7
|
+
# header |V=2|P| RC | PT=SR=200 | length |
|
|
8
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
9
|
+
# | SSRC of sender |
|
|
10
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
11
|
+
# sender | NTP timestamp, most significant word |
|
|
12
|
+
# info +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
13
|
+
# | NTP timestamp, least significant word |
|
|
14
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
15
|
+
# | RTP timestamp |
|
|
16
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
17
|
+
# | sender's packet count |
|
|
18
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
19
|
+
# | sender's octet count |
|
|
20
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
21
|
+
# report | SSRC_1 (SSRC of first source) |
|
|
22
|
+
# block +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
23
|
+
# 1 | fraction lost | cumulative number of packets lost |
|
|
24
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
25
|
+
# | extended highest sequence number received |
|
|
26
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
27
|
+
# | interarrival jitter |
|
|
28
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
29
|
+
# | last SR (LSR) |
|
|
30
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
31
|
+
# | delay since last SR (DLSR) |
|
|
32
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
33
|
+
# report | SSRC_2 (SSRC of second source) |
|
|
34
|
+
# block +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
35
|
+
# 2 : ... :
|
|
36
|
+
# +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|
|
37
|
+
# | profile-specific extensions |
|
|
38
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
39
|
+
|
|
40
|
+
class RTCP::SR < RTCP
|
|
41
|
+
|
|
42
|
+
PT_ID = 200
|
|
43
|
+
|
|
44
|
+
attr_reader :version, :ssrc, :rtp_timestamp, :ntp_timestamp,
|
|
45
|
+
:packet_count, :octet_count, :report_blocks, :padding
|
|
46
|
+
|
|
47
|
+
def decode(packet_data)
|
|
48
|
+
vprc, packet_type, length, @ssrc, ntp_h, ntp_l, @rtp_timestamp,
|
|
49
|
+
@packet_count, @octet_count = packet_data.unpack('CCnN6')
|
|
50
|
+
ensure_packet_type(packet_type)
|
|
51
|
+
@length = 4 * (length + 1)
|
|
52
|
+
@version, @padding, rc = decode_vprc(vprc, @length - 28)
|
|
53
|
+
@ntp_timestamp = Time.at(ntp_h - 2208988800 + (ntp_l.to_f / 0x100000000))
|
|
54
|
+
@report_blocks = decode_reports(payload_data(packet_data, @length, 28), rc)
|
|
55
|
+
self
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
protected
|
|
59
|
+
|
|
60
|
+
def decode_reports(data, count)
|
|
61
|
+
(1..count).collect do
|
|
62
|
+
*values, data = data.unpack('NCa3N4a*')
|
|
63
|
+
values[2] = (0.chr + values[2]).unpack('l>')[0]
|
|
64
|
+
|
|
65
|
+
Hash[[
|
|
66
|
+
:ssrc,
|
|
67
|
+
:fraction_lost,
|
|
68
|
+
:absolute_lost,
|
|
69
|
+
:highest_sequence_number,
|
|
70
|
+
:jitter,
|
|
71
|
+
:last_sr,
|
|
72
|
+
:delay_since_last_sr,
|
|
73
|
+
].zip(values)]
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def decode_vprc(vprc, payload_length)
|
|
78
|
+
rc = vprc & 0x1f
|
|
79
|
+
padding = vprc & 0x20 == 0x20
|
|
80
|
+
if !padding && (payload_length > rc * 24)
|
|
81
|
+
raise(RTCP::DecodeError, "Packet has undeclared padding")
|
|
82
|
+
end
|
|
83
|
+
[ (vprc >> 6), padding, rc ]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
data/lib/rtcp/version.rb
ADDED
data/lib/rtcp/xr.rb
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# XR: Extended Report RTCP Packet
|
|
2
|
+
# Documentation: RFC 3611, 2.
|
|
3
|
+
#
|
|
4
|
+
# 0 1 2 3
|
|
5
|
+
# 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
|
|
6
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
7
|
+
# |V=2|P|reserved | PT=XR=207 | length |
|
|
8
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
9
|
+
# | SSRC |
|
|
10
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
11
|
+
# : report blocks :
|
|
12
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
13
|
+
#
|
|
14
|
+
# An extended report block has the following format:
|
|
15
|
+
#
|
|
16
|
+
# 0 1 2 3
|
|
17
|
+
# 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
|
|
18
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
19
|
+
# | BT | type-specific | block length |
|
|
20
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
21
|
+
# : type-specific block contents :
|
|
22
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
23
|
+
#
|
|
24
|
+
# The Statistics Summary Report Block has the following format:
|
|
25
|
+
#
|
|
26
|
+
# 0 1 2 3
|
|
27
|
+
# 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
|
|
28
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
29
|
+
# | BT=6 |L|D|J|ToH|rsvd.| block length = 9 |
|
|
30
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
31
|
+
# | SSRC of source |
|
|
32
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
33
|
+
# | begin_seq | end_seq |
|
|
34
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
35
|
+
# | lost_packets |
|
|
36
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
37
|
+
# | dup_packets |
|
|
38
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
39
|
+
# | min_jitter |
|
|
40
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
41
|
+
# | max_jitter |
|
|
42
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
43
|
+
# | mean_jitter |
|
|
44
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
45
|
+
# | dev_jitter |
|
|
46
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
47
|
+
# | min_ttl_or_hl | max_ttl_or_hl |mean_ttl_or_hl | dev_ttl_or_hl |
|
|
48
|
+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
49
|
+
|
|
50
|
+
class RTCP::XR < RTCP
|
|
51
|
+
|
|
52
|
+
PT_ID = 207
|
|
53
|
+
|
|
54
|
+
attr_reader :version, :ssrc, :report_blocks, :padding
|
|
55
|
+
|
|
56
|
+
def decode(packet_data)
|
|
57
|
+
vprc, packet_type, length, @ssrc = packet_data.unpack('CCnN')
|
|
58
|
+
ensure_packet_type(packet_type)
|
|
59
|
+
|
|
60
|
+
@version = vprc >> 6
|
|
61
|
+
@length = 4 * (length + 1)
|
|
62
|
+
@report_blocks = []
|
|
63
|
+
|
|
64
|
+
report_block_data = payload_data(packet_data, @length, 8)
|
|
65
|
+
|
|
66
|
+
while report_block_data && report_block_data.length >= 4
|
|
67
|
+
bt, length = report_block_data.unpack('Cxn')
|
|
68
|
+
length = 4 * (length + 1)
|
|
69
|
+
@report_blocks.push case bt
|
|
70
|
+
when 1 # Loss RLE Report Block
|
|
71
|
+
decode_loss_rle(report_block_data)
|
|
72
|
+
when 6 # Statistics Summary Report
|
|
73
|
+
decode_ssr(report_block_data)
|
|
74
|
+
else
|
|
75
|
+
{
|
|
76
|
+
type: bt,
|
|
77
|
+
length: length,
|
|
78
|
+
data: report_block_data.slice(4..(length-1))
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
report_block_data = report_block_data.slice(length..-1)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Padding
|
|
86
|
+
if (vprc & 16 == 16)
|
|
87
|
+
@padding = report_block_data
|
|
88
|
+
elsif (report_block_data != '')
|
|
89
|
+
raise(RTCP::DecodeError, "Packet has undeclared padding")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
self
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
private
|
|
96
|
+
|
|
97
|
+
def decode_loss_rle(report_block_data)
|
|
98
|
+
thinning, length, ssrc, begin_seq, end_seq, *values =
|
|
99
|
+
report_block_data.unpack("xCnNn*")
|
|
100
|
+
|
|
101
|
+
thinnig = thinning & 15
|
|
102
|
+
length = 4 * (length + 1)
|
|
103
|
+
|
|
104
|
+
chunks = values.collect do |val|
|
|
105
|
+
if (val && 32768) == 32768
|
|
106
|
+
{
|
|
107
|
+
chunk_type: :run_length,
|
|
108
|
+
run_type: (val >> 14) & 1,
|
|
109
|
+
run_length: val & 16383,
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
{
|
|
113
|
+
chunk_type: :bit_vector,
|
|
114
|
+
run_length: val & 32767,
|
|
115
|
+
}
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
type: :loss_rle,
|
|
121
|
+
thinning: thinning,
|
|
122
|
+
begin_seq: begin_seq,
|
|
123
|
+
end_seq: end_seq,
|
|
124
|
+
chunks: chunks,
|
|
125
|
+
}
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def decode_ssr(report_block_data)
|
|
129
|
+
x, ssrc, begin_seq, end_seq, lost_packets, dup_packets, *values =
|
|
130
|
+
report_block_data.unpack("xCx2NnnN6C4")
|
|
131
|
+
|
|
132
|
+
report_block = {
|
|
133
|
+
ssrc: ssrc,
|
|
134
|
+
type: :statistics_summary,
|
|
135
|
+
begin_seq: begin_seq,
|
|
136
|
+
end_seq: end_seq,
|
|
137
|
+
}
|
|
138
|
+
@report_blocks.push(report_block)
|
|
139
|
+
|
|
140
|
+
if (x & 128 == 128)
|
|
141
|
+
report_block[:lost_packets] = lost_packets
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if (x & 64 == 64)
|
|
145
|
+
report_block[:dup_packets] = dup_packets
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if (x & 32 == 32)
|
|
149
|
+
report_block[:min_jitter] = values[0]
|
|
150
|
+
report_block[:max_jitter] = values[1]
|
|
151
|
+
report_block[:mean_jitter] = values[2]
|
|
152
|
+
report_block[:dev_jitter] = values[3]
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
case ((x >> 3) & 3)
|
|
156
|
+
when 1 # IPv4 TTL values
|
|
157
|
+
report_block[:min_ttl] = values[4]
|
|
158
|
+
report_block[:max_ttl] = values[5]
|
|
159
|
+
report_block[:mean_ttl] = values[6]
|
|
160
|
+
report_block[:dev_ttl] = values[7]
|
|
161
|
+
when 2 # IPv6 Hop Limit values
|
|
162
|
+
report_block[:min_hl] = values[4]
|
|
163
|
+
report_block[:max_hl] = values[5]
|
|
164
|
+
report_block[:mean_hl] = values[6]
|
|
165
|
+
report_block[:dev_hl] = values[7]
|
|
166
|
+
end
|
|
167
|
+
report_block
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
end
|
data/rtcp.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
2
|
+
require 'rtcp/version'
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = %q{rtcp}
|
|
6
|
+
s.version = RTCP::VERSION
|
|
7
|
+
s.author = "Christian Rusch"
|
|
8
|
+
|
|
9
|
+
s.description = %q{Parse RTCP data into Ruby objects}
|
|
10
|
+
|
|
11
|
+
s.email = %{git@rusch.asia}
|
|
12
|
+
s.extra_rdoc_files = Dir.glob("*.rdoc")
|
|
13
|
+
s.files = Dir.glob("{lib,spec}/**/*") + Dir.glob("*.rdoc") +
|
|
14
|
+
%w(Gemfile Rakefile rtcp.gemspec)
|
|
15
|
+
s.homepage = %{http://github.com/rusch/rtcp}
|
|
16
|
+
s.licenses = %w(MIT)
|
|
17
|
+
s.rubygems_version = %q{1.5.2}
|
|
18
|
+
s.summary = %{Parse RTCP data into Ruby objects}
|
|
19
|
+
s.test_files = Dir.glob("spec/**/*")
|
|
20
|
+
|
|
21
|
+
s.add_development_dependency 'bundler', "> 1.0.0"
|
|
22
|
+
s.add_development_dependency 'rake'
|
|
23
|
+
s.add_development_dependency 'rspec', ">= 2.6.0"
|
|
24
|
+
s.add_development_dependency 'simplecov', ">= 0.5.0"
|
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'simplecov'
|
|
2
|
+
SimpleCov.start do
|
|
3
|
+
add_filter "/spec/"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
7
|
+
|
|
8
|
+
def to_binary(data)
|
|
9
|
+
[ data.gsub(/\s+/,'').split(':').join ].pack('H*')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
|
|
13
|
+
include TestDescriptions
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
module TestDescriptions
|
|
2
|
+
|
|
3
|
+
##### 200: SR - Sender Report (RFC 3550)
|
|
4
|
+
|
|
5
|
+
# Extracted from example capture file available at:
|
|
6
|
+
# http://wiki.wireshark.org/RTCP
|
|
7
|
+
# Real-time Transport Control Protocol (Sender Report)
|
|
8
|
+
#
|
|
9
|
+
# Sender SSRC: 0xf3cb2001 (4090175489)
|
|
10
|
+
# MSW and LSW as NTP timestamp: Jan 1, 1970 09:28:01.917999000 UTC
|
|
11
|
+
# RTP timestamp: 37920
|
|
12
|
+
# Sender's packet count: 158
|
|
13
|
+
# Sender's octet count: 39816
|
|
14
|
+
SR_PACKET_1 = to_binary %q{
|
|
15
|
+
80:c8:00:06:f3:cb:20:01:83:ab:03:a1:eb:02:0b:3a:
|
|
16
|
+
00:00:94:20:00:00:00:9e:00:00:9b:88
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# Extracted from example capture file available at:
|
|
20
|
+
# https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4589
|
|
21
|
+
# MSW and LSW as NTP timestamp: Mar 17, 2010 07:49:41.844999000 UTC
|
|
22
|
+
# RTP timestamp: 342440
|
|
23
|
+
# Sender's packet count: 150
|
|
24
|
+
# Sender's octet count: 25800
|
|
25
|
+
# Source 1:
|
|
26
|
+
# Identifier: 0xecec92a6 (3974927014)
|
|
27
|
+
SR_PACKET_2 = to_binary %q{
|
|
28
|
+
81:c8:00:0c:d9:de:03:4d:cf:4b:08:15:d8:51:eb:85:
|
|
29
|
+
00:05:39:a8:00:00:00:96:00:00:64:c8:ec:ec:92:a6:
|
|
30
|
+
00:00:00:00:00:00:e5:97:00:00:00:02:00:00:00:00:
|
|
31
|
+
00:00:00:00
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
##### 201: RR - Receiver Report (RFC 3550)
|
|
35
|
+
|
|
36
|
+
RR_PACKET_1 = to_binary %q{
|
|
37
|
+
81:C9:00:07:3D:43:3B:B7:82:7A:AC:3D:00:00:00:00:
|
|
38
|
+
00:CB:34:3C:00:00:00:06:10:91:6C:D3:00:00:00:00
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
##### 202: SDES - Source Description (RFC 3550)
|
|
42
|
+
|
|
43
|
+
SDES_PACKET_1 = to_binary %q{
|
|
44
|
+
81:CA:00:06:3D:43:3B:B7:01:10:72:74:63:70:2E:65:
|
|
45
|
+
78:61:6D:70:6C:65:2E:63:6F:6D:00:00
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# Extracted from example capture file available at:
|
|
49
|
+
# http://wiki.wireshark.org/RTCP
|
|
50
|
+
# Real-time Transport Control Protocol (Sender Report)
|
|
51
|
+
#
|
|
52
|
+
# Chunk 1:
|
|
53
|
+
# Identifier: 0xf3cb2001 (4090175489)
|
|
54
|
+
# Type: CNAME (user and domain) (1)
|
|
55
|
+
# Text: outChannel
|
|
56
|
+
SDES_PACKET_2 = to_binary %q{
|
|
57
|
+
81:ca:00:05:f3:cb:20:01:01:0a:6f:75:74:43:68:61:
|
|
58
|
+
6e:6e:65:6c:00:00:00:00
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
##### 203: BYE - Goodbye (RFC 3550)
|
|
62
|
+
|
|
63
|
+
# Extracted from example capture file available at:
|
|
64
|
+
# http://www.wireshark.org/lists/wireshark-dev/200808/msg00050.html
|
|
65
|
+
#
|
|
66
|
+
# Identifier: 0x54857995 (1418033557)
|
|
67
|
+
# Text: mmptest
|
|
68
|
+
BYE_PACKET_1 = to_binary %q{
|
|
69
|
+
81:cb:00:03:54:85:79:95:07:6d:6d:70:74:65:73:74
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
##### 204: APP - Application Defined (RFC 3550)
|
|
73
|
+
|
|
74
|
+
# Capture from communication between Set-Top Box and VQE-S
|
|
75
|
+
APP_PACKET = to_binary %q{
|
|
76
|
+
81:CC:00:0B:EB:31:1D:FF:50:4C:49:49:06:00:04:00:
|
|
77
|
+
00:00:C8:07:00:04:00:00:0D:2E:0D:00:04:00:00:00:
|
|
78
|
+
01:0F:00:04:00:00:00:00:10:00:04:00:00:00:00:00
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
##### 206: PSFB - Payload-specific feedback (RFC 5760)
|
|
82
|
+
|
|
83
|
+
# Capture from communication between Set-Top Box and VQE-S
|
|
84
|
+
PSFB_PACKET = to_binary %q{
|
|
85
|
+
81:CE:00:02:EB:31:1D:FF:00:00:00:00
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
##### 207: XR - Extended Report (RFC 3611)
|
|
89
|
+
|
|
90
|
+
XR_PACKET_1 = to_binary %q{
|
|
91
|
+
81:CF:00:0F:3D:43:3B:B7:06:E0:00:09:82:7A:AC:3D:
|
|
92
|
+
1E:6F:34:3D:00:00:00:00:00:00:00:00:00:00:00:00:
|
|
93
|
+
00:00:00:15:00:00:00:06:00:00:00:05:00:00:00:00:
|
|
94
|
+
01:00:00:03:82:7A:AC:3D:1E:6F:34:3D:55:CC:E0:00
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Extracted from example capture file available at:
|
|
98
|
+
# https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4589
|
|
99
|
+
XR_PACKET_2 = to_binary %q{
|
|
100
|
+
80:cf:00:1e:ec:ec:92:a6:06:e8:00:09:ec:ec:92:a6:
|
|
101
|
+
1b:49:1c:9d:00:00:00:00:00:00:00:00:00:00:00:00:
|
|
102
|
+
00:00:00:50:00:00:00:04:00:00:00:df:01:02:03:04:
|
|
103
|
+
07:00:00:08:ec:ec:92:a6:00:00:00:00:00:00:1a:90:
|
|
104
|
+
00:00:00:41:2e:33:11:10:7f:7f:7f:7f:0a:00:00:14:
|
|
105
|
+
00:c8:01:f4:08:00:00:09:ec:ec:92:a6:1b:49:1c:9d:
|
|
106
|
+
00:0b:00:0b:00:00:00:0b:00:01:00:0f:00:00:00:00:
|
|
107
|
+
00:00:00:14:00:00:00:14:00:00:00:00
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
##### 208: AVB - Audio Video Bridging
|
|
111
|
+
|
|
112
|
+
AVB_PACKET = to_binary %q{
|
|
113
|
+
80:D0:00:06:3D:43:3B:B7:3D:43:3B:B7:D5:1C:10:91:
|
|
114
|
+
6C:D4:02:4B:0C:02:00:B2:00:00:00:02
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
##### 209: RSI - Receiver Summary Information (RFC 5760)
|
|
118
|
+
|
|
119
|
+
# Capture from communication between Set-Top Box and VQE-S
|
|
120
|
+
RSI_PACKET = to_binary %q{
|
|
121
|
+
81:D1:00:03:EB:31:1D:FF:00:00:00:00:93:61:A0:50
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
end
|