How to use the sdp-transform.write function in sdp-transform

To help you get started, we’ve selected a few sdp-transform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bigbluebutton / bbb-webrtc-sfu / lib / mcs-core / lib / utils / sdp-wrapper.js View on Github external
fmtps.forEach(fmtp => {
              let fmtpConfig = transform.parseParams(fmtp.config);
              // Reconfiguring the FMTP to coerce endpoints to obey to audio spec
              // IF audioCodec was defined in the spec
              if (spec[audioCodec]) {
                let configProfile = this._fetchOPUSProfileParams(spec[audioCodec]);
                fmtp.config = configProfile;
              }
            });
          }
        });
      }
    });


    return transform.write(res);
  }
github bigbluebutton / bbb-webrtc-sfu / lib / mcs-core / lib / utils / sdp-wrapper.js View on Github external
static getContentDescription (sdp) {
    var res = transform.parse(sdp);
    res.media = res.media.filter(SdpWrapper.isContentSlides);
    // No content:slides media in this one
    if (res.media.length <= 0) {
      return;
    }

    var mangledSdp = transform.write(res);
    if(typeof mangledSdp != undefined && mangledSdp && mangledSdp != "") {
      return mangledSdp;
    }
    else
      return sdp;
  }
github versatica / mediasoup-client / lib / handlers / sdp / RemoteUnifiedPlanSdp.js View on Github external
remoteMediaObj.rids.push(
						{
							id        : rid.id,
							direction : 'recv'
						});
				}
			}

			remoteMediaObj.rtcpMux = 'rtcp-mux';
			remoteMediaObj.rtcpRsize = 'rtcp-rsize';

			// Push it.
			sdpObj.media.push(remoteMediaObj);
		}

		const sdp = sdpTransform.write(sdpObj);

		return sdp;
	}
github jitsi / lib-jitsi-meet / modules / RTC / TraceablePeerConnection.js View on Github external
}
            });
            video.ssrcGroups = video.ssrcGroups || [];
            if (video.ssrcGroups.find(group => group.semantics === 'SIM')) {
                // Group already exists, no need to do anything
                return desc;
            }
            video.ssrcGroups.push({
                semantics: 'SIM',
                ssrcs: ssrcs.join(' ')
            });
        }

        return new RTCSessionDescription({
            type: desc.type,
            sdp: transform.write(sdp)
        });
    };
github pion / ion / sdk / js / src / Client.js View on Github external
if (session['media'][videoIdx]['ssrcGroups']) {
            let ssrcGroup = session['media'][videoIdx].ssrcGroups[0];
            let ssrcs = ssrcGroup.ssrcs;
            let videoSsrc = ssrcs.split(" ")[0];
            console.log('ssrcs => %s, video %s', ssrcs, videoSsrc);

            let newSsrcs = session['media'][videoIdx].ssrcs;
            newSsrcs = newSsrcs.filter(item => item.id == videoSsrc);

            session['media'][videoIdx].ssrcGroups = [];
            session['media'][videoIdx].ssrcs = newSsrcs;
        }

        let tmp = desc;
        tmp.sdp = sdpTransform.write(session);
        return tmp;
    }
github jitsi / lib-jitsi-meet / modules / RTC / TraceablePeerConnection.js View on Github external
delete mLine.ssrcs[i];
                    }
                }

                for (i = 0; i < mLine.ssrcs.length; i++) {
                    if (typeof mLine.ssrcs[i] !== 'undefined') {
                        newSsrcLines.push(mLine.ssrcs[i]);
                    }
                }

                mLine.ssrcs = replaceDefaultUnifiedPlanMsid(newSsrcLines);
            }
        });
    }

    const resStr = transform.write(session);


    return new RTCSessionDescription({
        type: desc.type,
        sdp: resStr
    });
};
github tan-tan-kanarek / mediasoup-server / lib / rtsp / source.js View on Github external
let headerExtension = stream.rtpParameters.headerExtensions[i];
				media.ext.push({
					value: headerExtension.id,
					uri: headerExtension.uri
				});
			}

			description.media.push(media);
		}

		description.groups.push({
			type: 'LS',
			mids: mids.join(' ')
		});

		return sdp_transform.write(description);
	}
}
github open-webrtc-toolkit / owt-server / source / agent / webrtc / sdp.js View on Github external
exports.processOffer = function (sdp, preference = {}, direction) {
  var sdpObj = transform.parse(sdp);
  filterVP9Payload(sdpObj);
  var finalProfile = filterH264Payload(sdpObj, preference, direction);
  var audioFormat = filterAudioPayload(sdpObj, preference.audio);
  var videoFormat = filterVideoPayload(sdpObj, preference.video);
  if (videoFormat && videoFormat.codec === 'h264') {
    videoFormat.profile = finalProfile;
  }
  sdp = transform.write(sdpObj);

  return { sdp, audioFormat, videoFormat};
};
github jitsi / lib-jitsi-meet / modules / RTC / BandwidthLimiter.js View on Github external
`Removing bandwidth limit for mline ${mLine.type}`);
                    delete mLine.bandwidth;
                } else {
                    logger.debug(`Enforcing limit ${limitKbps}kbps`
                        + ` for mline ${mLine.type}`);
                    mLine.bandwidth = [
                        {
                            type: 'AS',
                            limit: limitKbps
                        }
                    ];
                }
            }
        });

        return transform.write(desc);
    }
}
github bigbluebutton / bbb-webrtc-sfu / lib / h264-sdp.js View on Github external
validPayloads = res.media[mediaIndex].rtp.map(function(elem) {
    return elem.payload;
  });

  res.media[mediaIndex].fmtp = res.media[mediaIndex].fmtp.filter(function(elem) {
    return validPayloads.indexOf(elem.payload) >= 0;
  });

  res.media[mediaIndex].rtcpFb = res.media[mediaIndex].rtcpFb.filter(function(elem) {
    return validPayloads.indexOf(elem.payload) >= 0;
  });


  res.media[mediaIndex].payloads = validPayloads.join(' ');

  return sdpTransform.write(res);
};

sdp-transform

A simple parser/writer for the Session Description Protocol

MIT
Latest version published 9 months ago

Package Health Score

66 / 100
Full package analysis