mirror of
https://github.com/koush/scrypted.git
synced 2026-03-06 19:22:00 +00:00
rebroadcast: fix bug where packet length was parsed as signed integer.
This commit is contained in:
@@ -7,7 +7,7 @@ import { handleRebroadcasterClient, ParserOptions, ParserSession, startParserSes
|
||||
import { createMpegTsParser, createFragmentedMp4Parser, StreamChunk, StreamParser } from '@scrypted/common/src/stream-parser';
|
||||
import { AutoenableMixinProvider } from '@scrypted/common/src/autoenable-mixin-provider';
|
||||
import { listenZeroSingleClient } from '@scrypted/common/src/listen-cluster';
|
||||
import { parsePayloadTypes } from '@scrypted/common/src/sdp-utils';
|
||||
import { parsePayloadTypes, parseTrackIds } from '@scrypted/common/src/sdp-utils';
|
||||
import { createRtspParser, RtspClient, RtspServer } from '@scrypted/common/src/rtsp-server';
|
||||
import { Duplex } from 'stream';
|
||||
import net from 'net';
|
||||
@@ -446,8 +446,10 @@ class PrebufferSession {
|
||||
const sdpResponse = await rtspClient.describe();
|
||||
const sdp = sdpResponse.body.toString().trim();
|
||||
this.sdp = Promise.resolve(sdp);
|
||||
await rtspClient.setup(0, '/audio');
|
||||
await rtspClient.setup(2, '/video');
|
||||
const { audio, video } = parseTrackIds(sdp);
|
||||
// handle no audio?
|
||||
await rtspClient.setup(0, audio);
|
||||
await rtspClient.setup(2, video);
|
||||
const socket = await rtspClient.play();
|
||||
session = await startRFC4571Parser(socket, sdp, ffmpegInput.mediaStreamOptions, true, rbo);
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@ export async function startRFC4571Parser(socket: net.Socket, sdp: string, mediaS
|
||||
let length: number;
|
||||
if (hasRstpPrefix) {
|
||||
header = await readLength(socket, 4);
|
||||
length = header.readInt16BE(2);
|
||||
length = header.readUInt16BE(2);
|
||||
}
|
||||
else {
|
||||
header = await readLength(socket, 2);
|
||||
length = header.readInt16BE(0);
|
||||
length = header.readUInt16BE(0);
|
||||
}
|
||||
const data = await readLength(socket, length);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user