Sha256: 80ae0c8647d9faff19f0e61fab38456d2a77283c1d929a323be753fce966782a

Contents?: true

Size: 562 Bytes

Versions: 6

Compression:

Stored size: 562 Bytes

Contents

# encoding: utf-8
require 'sippy_cup/media/rtp_payload'

module SippyCup
  class Media
    class PCMUPayload < RTPPayload
      RTP_PAYLOAD_ID = 0x0
      SILENT_BYTE = 0xff.chr
      PTIME = 20 # in milliseconds
      RATE = 8 # in KHz
      attr_accessor :ptime

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

      def media
        SILENT_BYTE * timestamp_interval
      end

      def timestamp_interval
        @rate * @ptime
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sippy_cup-0.7.2 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.7.1 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.7.0 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.6.0 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.5.0 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.4.1 lib/sippy_cup/media/pcmu_payload.rb