Options
All
  • Public
  • Public/Protected
  • All
Menu

SDP includes a few helper functions for parsing sdp string.

Hierarchy

  • SDP

Index

Constructors

constructor

  • new SDP(sdp: string): SDP

Properties

sdp

sdp: string

Static rfc7587HighestBitrate

rfc7587HighestBitrate: number = 510000

Static rfc7587LowestBitrate

rfc7587LowestBitrate: number = 6000

Methods

clone

getRtpHeaderExtensionId

  • getRtpHeaderExtensionId(url: string): number
  • Return RTP header extension ID if the extension exists in SDP. Return -1 otherwise

    Parameters

    • url: string

    Returns number

getUniqueRtpHeaderExtensionId

  • getUniqueRtpHeaderExtensionId(srcLines: string[]): number
  • Returns the total number of unique Rtp header extensions.

    Parameters

    • srcLines: string[]

    Returns number

hasCandidates

  • hasCandidates(): boolean
  • Checks whether the SDP has candidates for any m-line

    Returns boolean

hasCandidatesForAllMLines

  • hasCandidatesForAllMLines(): boolean
  • Checks whether the SDP has candidates for all m-lines

    Returns boolean

hasRtpHeaderExtensionId

  • hasRtpHeaderExtensionId(targetId: number): boolean
  • Return if extension ID exists in the SDP

    Parameters

    • targetId: number

    Returns boolean

hasVideo

  • hasVideo(): boolean

highestPriorityVideoSendCodec

  • Returns the VideoCodecCapability which corresponds to the first payload type in the m-line (e.g. m=video 9 UDP/+++ <highest priority payload type> <payload type> <payload type> ...), parsing the rest of the SDP for relevant information to construct it.

    Returns undefined if there is no video send section or no codecs in the send section

    Returns VideoCodecCapability

lines

  • lines(): string[]

mediaSections

removeH264SupportFromSendSection

  • removeH264SupportFromSendSection(): SDP

ssrcForVideoSendingSection

  • ssrcForVideoSendingSection(): string
  • Extracts the ssrc for the sendrecv video media section in SDP

    Returns string

videoSendSectionHasDifferentSSRC

  • videoSendSectionHasDifferentSSRC(prevSdp: SDP): boolean
  • Returns whether the sendrecv video sections if exist have two different SSRCs in SDPs

    Parameters

    Returns boolean

withAudioMaxAverageBitrate

  • withAudioMaxAverageBitrate(maxAverageBitrate: number): SDP
  • Inserts a parameter to the SDP local offer setting the desired average audio bitrate

    Parameters

    • maxAverageBitrate: number

    Returns SDP

withStereoAudio

  • withStereoAudio(): SDP

withUnifiedPlanFormat

  • withUnifiedPlanFormat(): SDP
  • Munges Unified-Plan SDP from different browsers to conform to one format TODO: will remove this soon.

    Returns SDP

withVideoLayersAllocationRtpHeaderExtension

  • withVideoLayersAllocationRtpHeaderExtension(previousSdp: SDP): SDP
  • To avoid resubscribing to preemptively turn off simulcast streams or to switch layers negotiate with the back end to determine whether to use layers allocation header extension this will not add the packet overhead unless negotiated to avoid waste

    Parameters

    • previousSdp: SDP

    Returns SDP

withVideoSendCodecPreferences

  • Based off the provided preferences, this function will reorder the payload types listed in the m=video line.

    This will be applied to the a=sendrecv section so it can be applied on either local or remote SDPs. It can be used to 'polyfill' RTCRtpSender.setCodecPreferences' on the offer, but it can also be used on remote SDPs to force the codec actually being send, since the send codec is currently dependent on the remote answer (i.e. setCodecPreferences` doesn't actually have any impact unless the remote side respects the order of codecs).

    Parameters

    Returns SDP

withoutCandidateType

withoutServerReflexiveCandidates

  • withoutServerReflexiveCandidates(): SDP

Static candidateType

  • candidateType(sdpLine: string): string
  • Returns the candidate type assocaited with the sdpline.

    Parameters

    • sdpLine: string

    Returns string

Static candidateTypeFromString

Static extractSSRCsFromFIDGroupLine

  • extractSSRCsFromFIDGroupLine(figGroupLine: string): string
  • Extract the SSRCs from the group line.

    a=ssrc-group: ...

    Parameters

    • figGroupLine: string

    Returns string

Static findOpusFmtpAttributes

  • findOpusFmtpAttributes(sdpLines: string[]): string[]
  • Here we loop through each line in the SDP and construct an array containing the fmtp attribute for all the audio m lines that use the opus codec. If it doesn't use opus codec we add null to the array which tells updateOpusFmtpAttributes that no update is needed for that particular fmtp attribute line

    Parameters

    • sdpLines: string[]

    Returns string[]

Static getRtpHeaderExtensionIdInSection

  • getRtpHeaderExtensionIdInSection(section: string, url: string): number
  • Return RTP header extension ID if the extension exists in section. Return -1 otherwise

    Parameters

    • section: string
    • url: string

    Returns number

Static isRTPCandidate

  • isRTPCandidate(candidate: string): boolean
  • Checks if the candidate is a valid RTP candidate

    Parameters

    • candidate: string

    Returns boolean

Static linesToSDP

  • linesToSDP(lines: string[]): SDP
  • Constructs a new SDP with the given set of SDP lines.

    Parameters

    • lines: string[]

    Returns SDP

Static matchPrefix

  • matchPrefix(blob: string, prefix: string): string[]
  • Extracts the lines from the sdp blob that matches the given prefix.

    Parameters

    • blob: string
    • prefix: string

    Returns string[]

Static splitLines

  • splitLines(blob: string): string[]
  • Format the sdp string into separate lines.

    Parameters

    • blob: string

    Returns string[]

Static splitSections

  • splitSections(sdp: string): string[]
  • split the different sdp sections

    Parameters

    • sdp: string

    Returns string[]

Static updateOpusFmtpAttributes

  • updateOpusFmtpAttributes(srcLines: string[], fmtpAttributes: string[], additionalParams: string[]): string[]
  • Update the fmtp lines in each audio m section that correspond to the opus codec with the parameters specifief in additionalParams

    Parameters

    • srcLines: string[]
    • fmtpAttributes: string[]
    • additionalParams: string[]

    Returns string[]

Generated using TypeDoc