diff --git a/common/src/sdp-utils.ts b/common/src/sdp-utils.ts index 6f9519c24..ae4932a55 100644 --- a/common/src/sdp-utils.ts +++ b/common/src/sdp-utils.ts @@ -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) { diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index 368302d1a..81702bbbd 100644 --- a/plugins/prebuffer-mixin/package-lock.json +++ b/plugins/prebuffer-mixin/package-lock.json @@ -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", diff --git a/plugins/prebuffer-mixin/package.json b/plugins/prebuffer-mixin/package.json index d8444c391..f8ab47119 100644 --- a/plugins/prebuffer-mixin/package.json +++ b/plugins/prebuffer-mixin/package.json @@ -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",