提交 41fb9bf5 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix parsing of RTP header extensions.

上级 ce725b6f
...@@ -580,10 +580,17 @@ class RTCPeerConnectionPlanB extends EventEmitter ...@@ -580,10 +580,17 @@ class RTCPeerConnectionPlanB extends EventEmitter
{ {
for (let ext of parsedMedia.ext) for (let ext of parsedMedia.ext)
{ {
let id = ext.value;
let uri = ext.uri;
// TODO: Hack for https://github.com/clux/sdp-transform/issues/51
if (typeof id !== 'number')
id = parseInt(id);
headerExtensions.push( headerExtensions.push(
{ {
uri : ext.uri, uri : uri,
id : ext.value id : id
}); });
} }
} }
......
...@@ -88,11 +88,18 @@ module.exports = ...@@ -88,11 +88,18 @@ module.exports =
{ {
for (let ext of parsedMedia.ext) for (let ext of parsedMedia.ext)
{ {
let preferredId = ext.value;
let uri = ext.uri;
// TODO: Hack for https://github.com/clux/sdp-transform/issues/51
if (typeof preferredId !== 'number')
preferredId = parseInt(preferredId);
let headerExtension = let headerExtension =
{ {
kind : kind, kind : kind,
uri : ext.uri, uri : uri,
preferredId : ext.value preferredId : preferredId
}; };
// If same preferredId was already in the map with a different kind, // If same preferredId was already in the map with a different kind,
......
...@@ -39,7 +39,7 @@ namespace RTC ...@@ -39,7 +39,7 @@ namespace RTC
MS_THROW_ERROR("empty RtpHeaderExtension.uri"); MS_THROW_ERROR("empty RtpHeaderExtension.uri");
// `preferredId` is mandatory. // `preferredId` is mandatory.
if (!data[k_preferredId].asUInt()) if (!data[k_preferredId].isUInt())
MS_THROW_ERROR("missing RtpHeaderExtension.preferredId"); MS_THROW_ERROR("missing RtpHeaderExtension.preferredId");
this->preferredId = (uint16_t)data[k_preferredId].asUInt(); this->preferredId = (uint16_t)data[k_preferredId].asUInt();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论