mirror of
https://github.com/koush/scrypted.git
synced 2026-02-12 01:54:27 +00:00
webrtc: add transport logging, add container hint
This commit is contained in:
4
plugins/webrtc/package-lock.json
generated
4
plugins/webrtc/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"dependencies": {
|
||||
"@koush/werift": "file:../../external/werift/packages/webrtc",
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"scripts": {
|
||||
"prepublishOnly": "NODE_ENV=production scrypted-webpack",
|
||||
"prescrypted-vscode-launch": "scrypted-webpack",
|
||||
|
||||
@@ -5,13 +5,12 @@ import { connectRTCSignalingClients } from "@scrypted/common/src/rtc-signaling";
|
||||
import { RtspServer } from "@scrypted/common/src/rtsp-server";
|
||||
import { createSdpInput, parseSdp } from "@scrypted/common/src/sdp-utils";
|
||||
import sdk, { FFmpegInput, Intercom, MediaStreamDestination, MediaStreamTool, RTCAVSignalingSetup, RTCSignalingSession } from "@scrypted/sdk";
|
||||
import ip from 'ip';
|
||||
import { WeriftOutputSignalingSession } from "./output-signaling-session";
|
||||
import { waitConnected } from "./peerconnection-util";
|
||||
import { getFFmpegRtpAudioOutputArguments, RtpTrack, RtpTracks, startRtpForwarderProcess } from "./rtp-forwarders";
|
||||
import { ScryptedSessionControl } from "./session-control";
|
||||
import { requiredAudioCodecs, requiredVideoCodec } from "./webrtc-required-codecs";
|
||||
import { isPeerConnectionAlive } from "./werift-util";
|
||||
import { isPeerConnectionAlive, logIsPrivateIceTransport } from "./werift-util";
|
||||
|
||||
const { mediaManager } = sdk;
|
||||
|
||||
@@ -169,15 +168,7 @@ export async function createRTCPeerConnectionSink(
|
||||
await waitConnected(pc);
|
||||
|
||||
console.log('connected', Date.now() - timeStart);
|
||||
|
||||
let isPrivate = true;
|
||||
for (const ice of pc.iceTransports) {
|
||||
const [address, port] = ice.connection.remoteAddr;
|
||||
isPrivate = isPrivate && ip.isPrivate(address);
|
||||
console.log('ice transport ip', address);
|
||||
}
|
||||
|
||||
console.log('Connection is local network:', isPrivate);
|
||||
const isPrivate = logIsPrivateIceTransport(console, pc);
|
||||
|
||||
// should really inspect the session description here.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { RTCIceServer, RTCPeerConnection, RTCSessionDescription } from "@koush/werift";
|
||||
import ip from 'ip';
|
||||
|
||||
export function createRawResponse(response: RTCSessionDescription): RTCSessionDescriptionInit {
|
||||
return {
|
||||
@@ -40,3 +41,14 @@ export function getWeriftIceServers(configuration: RTCConfiguration): RTCIceServ
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function logIsPrivateIceTransport(console: Console, pc: RTCPeerConnection) {
|
||||
let isPrivate = true;
|
||||
for (const ice of pc.iceTransports) {
|
||||
const [address, port] = ice.connection.remoteAddr;
|
||||
isPrivate = isPrivate && ip.isPrivate(address);
|
||||
console.log('ice transport ip', address);
|
||||
}
|
||||
console.log('Connection is local network:', isPrivate);
|
||||
return isPrivate;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { BundlePolicy, Output, Pipeline, RTCPeerConnection, RtcpPacket, RtcpPayloadSpecificFeedback, RTCRtpTransceiver, RTCSessionDescription, RtpPacket, uint16Add } from "@koush/werift";
|
||||
import { BundlePolicy, Pipeline, RTCPeerConnection, RtcpPacket, RtcpPayloadSpecificFeedback, RTCRtpTransceiver, RtpPacket, uint16Add } from "@koush/werift";
|
||||
import { FullIntraRequest } from "@koush/werift/lib/rtp/src/rtcp/psfb/fullIntraRequest";
|
||||
import { listenZeroSingleClient } from "@scrypted/common/src/listen-cluster";
|
||||
import { findH264NaluType, findH264NaluTypeInNalu, getNaluTypesInNalu, H264_NAL_TYPE_IDR, RtspServer } from "@scrypted/common/src/rtsp-server";
|
||||
import { getNaluTypesInNalu, RtspServer } from "@scrypted/common/src/rtsp-server";
|
||||
import { createSdpInput, parseSdp } from '@scrypted/common/src/sdp-utils';
|
||||
import sdk, { FFmpegInput, Intercom, MediaObject, MediaStreamUrl, ResponseMediaStreamOptions, RTCAVSignalingSetup, RTCSessionControl, RTCSignalingChannel, RTCSignalingOptions, RTCSignalingSendIceCandidate, RTCSignalingSession, ScryptedMimeTypes } from "@scrypted/sdk";
|
||||
import dgram from 'dgram';
|
||||
@@ -9,7 +9,7 @@ import { Socket } from "net";
|
||||
import { waitConnected } from "./peerconnection-util";
|
||||
import { getFFmpegRtpAudioOutputArguments, startRtpForwarderProcess } from "./rtp-forwarders";
|
||||
import { requiredAudioCodecs, requiredVideoCodec } from "./webrtc-required-codecs";
|
||||
import { createRawResponse, getWeriftIceServers, isPeerConnectionAlive } from "./werift-util";
|
||||
import { createRawResponse, getWeriftIceServers, isPeerConnectionAlive, logIsPrivateIceTransport } from "./werift-util";
|
||||
|
||||
const { mediaManager } = sdk;
|
||||
|
||||
@@ -98,6 +98,7 @@ export async function createRTCPeerConnectionSource(options: {
|
||||
|
||||
waitConnected(pc).then(() => {
|
||||
console.log('connected', Date.now() - timeStart);
|
||||
logIsPrivateIceTransport(console, pc);
|
||||
sessionControl.startSession().catch(() => { });
|
||||
});
|
||||
|
||||
@@ -297,6 +298,7 @@ export async function createRTCPeerConnectionSource(options: {
|
||||
const url = `rtsp://127.0.0.1:${port}`;
|
||||
const mediaStreamUrl: MediaStreamUrl = {
|
||||
url,
|
||||
container: 'rtsp',
|
||||
mediaStreamOptions,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user