Class: RTCP::PSFB

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

Overview

PSFB: Payload-specific FB message Documentation: RFC 4585, 6.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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|   FMT   |       PT      |          length               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  SSRC of packet sender                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  SSRC of media source                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
:            Feedback Control Information (FCI)                 :
:                                                               :

Constant Summary collapse

FORMATS =
{
  1 => :pli,  # Picture Loss Indication (PLI)
  2 => :sli,  # Slice Loss Indication (SLI)
  3 => :rpsi, # Reference Picture Selection Indication (RPSI)
 15 => :afb,  # Application layer FB (AFB) message
}
PT_ID =
206

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

#fciObject (readonly)

Returns the value of attribute fci.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def fci
  @fci
end

#first_mbObject (readonly)

Returns the value of attribute first_mb.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def first_mb
  @first_mb
end

#formatObject (readonly)

Returns the value of attribute format.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def format
  @format
end

#numberObject (readonly)

Returns the value of attribute number.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def number
  @number
end

#picture_idObject (readonly)

Returns the value of attribute picture_id.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def picture_id
  @picture_id
end

#sender_ssrcObject (readonly)

Returns the value of attribute sender_ssrc.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def sender_ssrc
  @sender_ssrc
end

#source_ssrcObject (readonly)

Returns the value of attribute source_ssrc.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def source_ssrc
  @source_ssrc
end

#versionObject (readonly)

Returns the value of attribute version.



27
28
29
# File 'lib/rtcp/psfb.rb', line 27

def version
  @version
end

Instance Method Details

#decode(packet_data) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rtcp/psfb.rb', line 30

def decode(packet_data) 
  vpfmt, packet_type, length, @sender_ssrc, @source_ssrc =
    packet_data.unpack('CCnN2')
  ensure_packet_type(packet_type)

  @length  = 4 * (length + 1)
  @version = vpfmt >> 6
  format  = vpfmt & 31
  @format = FORMATS[format] || format

  @fci_data = payload_data(packet_data, @length, 12)

  case @format
  when :sli
    pl  = @fci_data.unpack('L')
    @first_mb   = pl >> 19
    @number     = (pl >> 6) & 8191
    @picture_id = pl & 63
  # when :pli # No parameters
  # when :rpsi
  # when :afb
  end
  self
end