Class: RTCP::SR

Inherits:
RTCP
  • Object
show all
Defined in:
lib/rtcp/sr.rb

Overview

SR: Sender Report RTCP Packet Documentation: RFC 3550, 6.4.1

 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| RC | PT=SR=200 | length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         SSRC of sender                        |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

sender | NTP timestamp, most significant word | info --------------------------------+

|             NTP timestamp, least significant word             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         RTP timestamp                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     sender's packet count                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      sender's octet count                     |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

report | SSRC_1 (SSRC of first source) | block --------------------------------+

1    | fraction lost |       cumulative number of packets lost       |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |           extended highest sequence number received           |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                      interarrival jitter                      |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                         last SR (LSR)                         |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                   delay since last SR (DLSR)                  |
     +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

report | SSRC_2 (SSRC of second source) | block --------------------------------+

2    :                               ...                             :
     +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
     |                  profile-specific extensions                  |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Direct Known Subclasses

RR

Constant Summary collapse

PT_ID =
200

Constants inherited from RTCP

VERSION

Instance Attribute Summary collapse

Attributes inherited from RTCP

#length, #type_id

Instance Method Summary collapse

Methods inherited from RTCP

decode, decode_all, #to_s

Instance Attribute Details

#ntp_timestampObject (readonly)

Returns the value of attribute ntp_timestamp.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def ntp_timestamp
  @ntp_timestamp
end

#octet_countObject (readonly)

Returns the value of attribute octet_count.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def octet_count
  @octet_count
end

#packet_countObject (readonly)

Returns the value of attribute packet_count.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def packet_count
  @packet_count
end

#paddingObject (readonly)

Returns the value of attribute padding.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def padding
  @padding
end

#report_blocksObject (readonly)

Returns the value of attribute report_blocks.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def report_blocks
  @report_blocks
end

#rtp_timestampObject (readonly)

Returns the value of attribute rtp_timestamp.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def rtp_timestamp
  @rtp_timestamp
end

#ssrcObject (readonly)

Returns the value of attribute ssrc.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def ssrc
  @ssrc
end

#versionObject (readonly)

Returns the value of attribute version.



44
45
46
# File 'lib/rtcp/sr.rb', line 44

def version
  @version
end

Instance Method Details

#decode(packet_data) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/rtcp/sr.rb', line 47

def decode(packet_data)
  vprc, packet_type, length, @ssrc, ntp_h, ntp_l, @rtp_timestamp,
    @packet_count, @octet_count = packet_data.unpack('CCnN6')
  ensure_packet_type(packet_type)
  @length  = 4 * (length + 1)
  @version, @padding, rc = decode_vprc(vprc, @length - 28)
  @ntp_timestamp = Time.at(ntp_h - 2208988800 + (ntp_l.to_f / 0x100000000))
  @report_blocks = decode_reports(payload_data(packet_data, @length, 28), rc)
  self
end