rebroadcast: Fix audio codec parsing bug

This commit is contained in:
Koushik Dutta
2023-05-06 12:01:25 -07:00
parent 042dd84520
commit 37b0e46dd0
3 changed files with 7 additions and 22 deletions

View File

@@ -218,26 +218,11 @@ const artpmap = 'a=rtpmap:';
export function parseMSection(msection: string[]) {
const control = msection.find(line => line.startsWith(acontrol))?.substring(acontrol.length);
const mline = parseMLine(msection[0]);
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';
}
const rawRtpmaps = msection.filter(line => line.startsWith(artpmap));
const rtpmaps = rawRtpmaps.map(line => parseRtpMap(mline.type, line));
const codec = parseRtpMap(mline.type, rawRtpmaps[0]).codec;
let direction: string;
for (const checkDirection of ['sendonly', 'sendrecv', 'recvonly', 'inactive']) {
const found = msection.find(line => line === 'a=' + checkDirection);
if (found) {

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.9.85",
"version": "0.9.86",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/prebuffer-mixin",
"version": "0.9.85",
"version": "0.9.86",
"license": "Apache-2.0",
"dependencies": {
"@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.9.85",
"version": "0.9.86",
"description": "Video Stream Rebroadcast, Prebuffer, and Management Plugin for Scrypted.",
"author": "Scrypted",
"license": "Apache-2.0",