Sha256: 921a95ca2b43a0fe2e52695ac07fe17698fad51f844a9e4a62393bab9b7dcee8

Contents?: true

Size: 544 Bytes

Versions: 8

Compression:

Stored size: 544 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
sippy_cup-0.4.0 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.3.0 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.2.3 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.2.2 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.2.1 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.2.0 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.1.1 lib/sippy_cup/media/pcmu_payload.rb
sippy_cup-0.1.0 lib/sippy_cup/media/pcmu_payload.rb