Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
const Transponder = require("./Transponder");
function getStatsFromOutgoingSource(source)
{
return {
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
bitrate : source.bitrate // Acumulator window is 1000ms so Instant==InstantAvg
};
}
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
const Transponder = require("./Transponder");
function getStatsFromOutgoingSource(source)
{
return {
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
bitrate : source.bitrate // Acumulator window is 1000ms so Instant==InstantAvg
};
}
/**
const Native = require("./Native");
const EventEmitter = require("events").EventEmitter;
const LayerInfo = require("./LayerInfo");
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const TrackEncodingInfo = SemanticSDP.TrackEncodingInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
function getStatsFromIncomingSource(source)
{
const stats = {
lostPackets : source.lostPackets,
dropPackets : source.dropPackets,
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
totalPLIs : source.totalPLIs,
totalNACKs : source.totalNACKs,
bitrate : source.bitrate, // Acumulator window is 1000ms so Instant==InstantAvg
layers : [],
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
const Transponder = require("./Transponder");
function getStatsFromOutgoingSource(source)
{
return {
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
bitrate : source.bitrate // Acumulator window is 1000ms so Instant==InstantAvg
const Native = require("./Native");
const EventEmitter = require("events").EventEmitter;
const LayerInfo = require("./LayerInfo");
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const TrackEncodingInfo = SemanticSDP.TrackEncodingInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
function getStatsFromIncomingSource(source)
{
const stats = {
lostPackets : source.lostPackets,
dropPackets : source.dropPackets,
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
totalPLIs : source.totalPLIs,
totalNACKs : source.totalNACKs,
bitrate : source.bitrate, // Acumulator window is 1000ms so Instant==InstantAvg
layers : [],
};
const Native = require("./Native");
const EventEmitter = require('events').EventEmitter;
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
const Transponder = require("./Transponder");
function getStatsFromOutgoingSource(source)
{
return {
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
bitrate : source.bitrate // Acumulator window is 1000ms so Instant==InstantAvg
};
}
/**
* Audio or Video track of a media stream sent to a remote peer
const Native = require("./Native");
const EventEmitter = require("events").EventEmitter;
const LayerInfo = require("./LayerInfo");
const SemanticSDP = require("semantic-sdp");
const SDPInfo = SemanticSDP.SDPInfo;
const Setup = SemanticSDP.Setup;
const MediaInfo = SemanticSDP.MediaInfo;
const CandidateInfo = SemanticSDP.CandidateInfo;
const DTLSInfo = SemanticSDP.DTLSInfo;
const ICEInfo = SemanticSDP.ICEInfo;
const StreamInfo = SemanticSDP.StreamInfo;
const TrackInfo = SemanticSDP.TrackInfo;
const TrackEncodingInfo = SemanticSDP.TrackEncodingInfo;
const SourceGroupInfo = SemanticSDP.SourceGroupInfo;
function getStatsFromIncomingSource(source)
{
const stats = {
lostPackets : source.lostPackets,
dropPackets : source.dropPackets,
numPackets : source.numPackets,
numRTCPPackets : source.numRTCPPackets,
totalBytes : source.totalBytes,
totalRTCPBytes : source.totalRTCPBytes,
totalPLIs : source.totalPLIs,
totalNACKs : source.totalNACKs,
bitrate : source.bitrate, // Acumulator window is 1000ms so Instant==InstantAvg
layers : [],
};
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under
// the License.
//
import {
CodecInfo
} from 'semantic-sdp'
export const videoCodecs = CodecInfo.MapFromNames(['VP8'], true)
export const headerExtensions = new Set([
'urn:ietf:params:rtp-hdrext:toffset',
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time',
'urn:3gpp:video-orientation',
'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01',
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay',
'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id',
'urn:ietf:params:rtp-hdrext:sdes:repair-rtp-stream-id',
'urn:ietf:params:rtp-hdrext:sdes:mid'
])
export const initOffer = (endpoint, offerSdp) => {
const offer = SDPInfo.process(offerSdp)
// transport :: Transport
const transport = endpoint.createTransport({
dtls: offer.getDTLS(),
ice: offer.getICE()
})
transport.setRemoteProperties({
audio: offer.getMedia('audio'),
video: offer.getMedia('video')
})
// answer :: SDPInfo
const answer = new SDPInfo()
// dtlsInfo :: DTLSInfo
const dtlsInfo = transport.getLocalDTLSInfo()
answer.setDTLS(dtlsInfo)
// iceInfo :: ICEInfo
const iceInfo = transport.getLocalICEInfo()
answer.setICE(iceInfo)
// localCandidates :: Array CandidateInfo
const localCandidates = endpoint.getLocalCandidates()
for (const candidate of localCandidates) {
answer.addCandidate(candidate)
}
return {
export const initOffer = (endpoint, offerSdp) => {
const offer = SDPInfo.process(offerSdp)
// transport :: Transport
const transport = endpoint.createTransport({
dtls: offer.getDTLS(),
ice: offer.getICE()
})
transport.setRemoteProperties({
audio: offer.getMedia('audio'),
video: offer.getMedia('video')
})
// answer :: SDPInfo
const answer = new SDPInfo()
// dtlsInfo :: DTLSInfo