/** * Fakes local SDP exposed to {@link JingleSessionPC} through the local * description getter. Modifies the SDP, so that it will contain muted local * video tracks description, even though their underlying {MediaStreamTrack}s * are no longer in the WebRTC peerconnection. That prevents from SSRC updates * being sent to Jicofo/remote peer and prevents sRD/sLD cycle on the remote * side. */ export default class LocalSdpMunger { /** * Creates new LocalSdpMunger instance. * * @param {TraceablePeerConnection} tpc * @param {string} localEndpointId - The endpoint id of the local user. */ constructor(tpc: any, localEndpointId: string); tpc: any; localEndpointId: string; audioSourcesToMsidMap: Map; videoSourcesToMsidMap: Map; /** * Makes sure that muted local video tracks associated with the parent * {@link TraceablePeerConnection} are described in the local SDP. It's done * in order to prevent from sending 'source-remove'/'source-add' Jingle * notifications when local video track is muted (MediaStream is * removed from the peerconnection). * * NOTE 1 video track is assumed * * @param {SdpTransformWrap} transformer the transformer instance which will * be used to process the SDP. * @return {boolean} true if there were any modifications to * the SDP wrapped by transformer. * @private */ private _addMutedLocalVideoTracksToSDP; /** * Returns a string that can be set as the MSID attribute for a source. * * @param {string} mediaType - Media type of the source. * @param {string} trackId - Id of the MediaStreamTrack associated with the source. * @param {string} streamId - Id of the MediaStream associated with the source. * @returns {string|null} */ _generateMsidAttribute(mediaType: string, trackId: string, streamId: string): string | null; /** * Updates or adds a 'msid' attribute in the format '---' * example - d8ff91-video-0-1 * All other attributes like 'cname', 'label' and 'mslabel' are removed since these are not processed by Jicofo. * * @param {MLineWrap} mediaSection - The media part (audio or video) of the session description which will be * modified in place. * @returns {void} * @private */ private _transformMediaIdentifiers; /** * Updates the MSID map. * * @param {string} mediaType The media type. * @param {string} streamId The stream id. * @param {string} trackId The track id. * @returns {void} */ _updateSourcesToMsidMap(mediaType: string, streamId: string, trackId: string): void; /** * Maybe modifies local description to fake local video tracks SDP when * those are muted. * * @param {object} desc the WebRTC SDP object instance for the local * description. * @returns {RTCSessionDescription} */ maybeAddMutedLocalVideoTracksToSDP(desc: object): RTCSessionDescription; /** * This transformation will make sure that stream identifiers are unique * across all of the local PeerConnections even if the same stream is used * by multiple instances at the same time. * Each PeerConnection assigns different SSRCs to the same local * MediaStream, but the MSID remains the same as it's used to identify * the stream by the WebRTC backend. The transformation will append * {@link TraceablePeerConnection#id} at the end of each stream's identifier * ("cname", "msid", "label" and "mslabel"). * * @param {RTCSessionDescription} sessionDesc - The local session * description (this instance remains unchanged). * @return {RTCSessionDescription} - Transformed local session description * (a modified copy of the one given as the input). */ transformStreamIdentifiers(sessionDesc: RTCSessionDescription): RTCSessionDescription; /** * Injects source names. Source names are need to for multiple streams per endpoint support. The final plan is to * use the "mid" attribute for source names, but because the SDP to Jingle conversion still operates in the Plan-B * semantics (one source name per media), a custom "name" attribute is injected into SSRC lines.. * * @param {MLineWrap} mediaSection - The media part (audio or video) of the session description which will be * modified in place. * @returns {void} * @private */ private _injectSourceNames; }