Class: SippyCup::Media::PCMUPayload

Inherits:
RTPPayload show all
Defined in:
lib/sippy_cup/media/pcmu_payload.rb

Constant Summary collapse

RTP_PAYLOAD_ID =
0x0
SILENT_BYTE =
0xff.chr
PTIME =

in milliseconds

20
RATE =

in KHz

8

Instance Attribute Summary collapse

Attributes inherited from RTPPayload

#header

Instance Method Summary collapse

Methods inherited from RTPPayload

#method_missing, #to_bytes

Constructor Details

#initialize(opts = {}) ⇒ PCMUPayload

Returns a new instance of PCMUPayload.



13
14
15
16
17
# File 'lib/sippy_cup/media/pcmu_payload.rb', line 13

def initialize(opts = {})
  super RTP_PAYLOAD_ID
  @ptime = opts[:ptime] || PTIME
  @rate  = opts[:rate]  || RATE
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SippyCup::Media::RTPPayload

Instance Attribute Details

#ptimeObject

Returns the value of attribute ptime.



11
12
13
# File 'lib/sippy_cup/media/pcmu_payload.rb', line 11

def ptime
  @ptime
end

Instance Method Details

#mediaObject



19
20
21
# File 'lib/sippy_cup/media/pcmu_payload.rb', line 19

def media
  SILENT_BYTE * timestamp_interval
end

#timestamp_intervalObject



23
24
25
# File 'lib/sippy_cup/media/pcmu_payload.rb', line 23

def timestamp_interval
  @rate * @ptime
end