mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
rebroadcast/webrtc: fixup pcm_ulaw handling
This commit is contained in:
@@ -269,7 +269,11 @@ export async function startParserSession<T extends string>(ffmpegInput: FFmpegIn
|
||||
};
|
||||
|
||||
// tbh parsing stdout is super sketchy way of doing this.
|
||||
parseAudioCodec(cp).then(result => inputAudioCodec = result);
|
||||
parseAudioCodec(cp).then(result => {
|
||||
inputAudioCodec = result;
|
||||
if (inputAudioCodec === 'pcm_mulaw')
|
||||
inputAudioCodec = 'pcm_ulaw';
|
||||
});
|
||||
parseResolution(cp).then(result => inputVideoResolution = result);
|
||||
await parseVideoCodec(cp).then(result => inputVideoCodec = result);
|
||||
|
||||
|
||||
@@ -217,13 +217,26 @@ const acontrol = 'a=control:';
|
||||
const artpmap = 'a=rtpmap:';
|
||||
export function parseMSection(msection: string[]) {
|
||||
const control = msection.find(line => line.startsWith(acontrol))?.substring(acontrol.length);
|
||||
const rtpmapFirst = msection.find(line => line.startsWith(artpmap));
|
||||
const mline = parseMLine(msection[0]);
|
||||
|
||||
let codec = parseRtpMap(mline.type, rtpmapFirst).codec;
|
||||
|
||||
const rtpmaps = msection.filter(line => line.startsWith(artpmap)).map(line => parseRtpMap(mline.type, line));
|
||||
|
||||
let codec: string;
|
||||
const [rtpmapFirst] = rtpmaps;
|
||||
if (rtpmapFirst) {
|
||||
codec = rtpmapFirst.codec;
|
||||
}
|
||||
else {
|
||||
// just guess
|
||||
const [firstPayloadType ] = mline.payloadTypes;
|
||||
if (firstPayloadType === 0)
|
||||
codec = 'pcm_ulaw';
|
||||
else if (firstPayloadType === 8)
|
||||
codec = 'pcm_alaw';
|
||||
else
|
||||
codec = 'pcm_alaw';
|
||||
}
|
||||
|
||||
let direction: string;
|
||||
for (const checkDirection of ['sendonly', 'sendrecv', 'recvonly', 'inactive']) {
|
||||
const found = msection.find(line => line === 'a=' + checkDirection);
|
||||
|
||||
4
plugins/prebuffer-mixin/package-lock.json
generated
4
plugins/prebuffer-mixin/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/prebuffer-mixin",
|
||||
"version": "0.9.84",
|
||||
"version": "0.9.85",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/prebuffer-mixin",
|
||||
"version": "0.9.84",
|
||||
"version": "0.9.85",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/prebuffer-mixin",
|
||||
"version": "0.9.84",
|
||||
"version": "0.9.85",
|
||||
"description": "Video Stream Rebroadcast, Prebuffer, and Management Plugin for Scrypted.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
4
plugins/webrtc/package-lock.json
generated
4
plugins/webrtc/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.44",
|
||||
"version": "0.1.45",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.44",
|
||||
"version": "0.1.45",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
"@scrypted/sdk": "file:../../sdk",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.1.44",
|
||||
"version": "0.1.45",
|
||||
"scripts": {
|
||||
"scrypted-setup-project": "scrypted-setup-project",
|
||||
"prescrypted-setup-project": "scrypted-package-json",
|
||||
|
||||
@@ -109,7 +109,7 @@ export async function createTrackForwarder(options: {
|
||||
|
||||
if (!maximumCompatibilityMode) {
|
||||
let found: RTCRtpCodecParameters;
|
||||
if (mediaStreamOptions?.audio?.codec === 'pcm_mulaw') {
|
||||
if (mediaStreamOptions?.audio?.codec === 'pcm_ulaw') {
|
||||
found = audioTransceiver.codecs.find(codec => codec.mimeType === 'audio/PCMU')
|
||||
}
|
||||
else if (mediaStreamOptions?.audio?.codec === 'pcm_alaw') {
|
||||
|
||||
@@ -50,7 +50,7 @@ export function getAudioCodec(outputCodecParameters: RTCRtpCodecParameters) {
|
||||
}
|
||||
if (outputCodecParameters.name === 'PCMU') {
|
||||
return {
|
||||
name: 'pcm_mulaw',
|
||||
name: 'pcm_ulaw',
|
||||
encoder: 'pcm_mulaw',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user