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

Match H264 params.

上级 b80cda02
......@@ -40,8 +40,6 @@ mediasoup:WARN:mediasoup-worker [id:bnicjuxw#1] RTC::Transport::HandleConsumer()
* Implement `mandatoryCodecPayloadTypes`.
* Check H246 parameters.
* JS: Remove tons of useless debugs (for example in `Peer._createProducer()`).
* Producer JS API to request fullframe.
......@@ -44,7 +44,7 @@ exports.generateRoomRtpCapabilities = function(mediaCodecs)
const matchedSupportedCodec = supportedCodecs
.find((supportedCodec) =>
{
return matchCodec(mediaCodec, supportedCodec);
return matchCodecs(mediaCodec, supportedCodec);
});
if (!matchedSupportedCodec)
......@@ -124,7 +124,7 @@ exports.assertCapabilitiesSubset = function(capsA, capsB)
{
return (
codecA.preferredPayloadType === codecB.preferredPayloadType &&
matchCodec(codecA, codecB)
matchCodecs(codecA, codecB)
);
});
......@@ -178,7 +178,7 @@ exports.getProducerRtpParametersMapping = function(params, caps)
// Search for the same media codec in capabilities.
const matchedCapCodec = caps.codecs
.find((capCodec) => matchCodec(codec, capCodec, true));
.find((capCodec) => matchCodecs(codec, capCodec));
if (!matchedCapCodec)
{
......@@ -240,7 +240,7 @@ exports.getProducerRtpParametersMapping = function(params, caps)
for (const ext of params.headerExtensions)
{
const matchedCapExt = caps.headerExtensions
.find((capExt) => matchHeaderExtensions(ext, capExt, true));
.find((capExt) => matchHeaderExtensions(ext, capExt));
if (!matchedCapExt)
{
......@@ -455,41 +455,44 @@ function assertCodecCapability(codec)
throw new TypeError('invalid RTCCodecCapability');
}
function matchCodec(codecA, codecB, leftIsParam = false)
function matchCodecs(aCodec, bCodec)
{
if (!leftIsParam)
const aName = aCodec.name.toLowerCase();
const bName = bCodec.name.toLowerCase();
if (aCodec.kind && bCodec.kind && aCodec.kind !== bCodec.kind)
{
if (codecA.kind !== codecB.kind)
return false;
return false;
}
if (codecA.name.toLowerCase() !== codecB.name.toLowerCase())
if (aName !== bName)
return false;
if (codecA.clockRate !== codecB.clockRate)
if (aCodec.clockRate !== bCodec.clockRate)
return false;
if (
(codecA.channels > 1 || codecB.channels > 1) &&
codecA.channels !== codecB.channels)
{
if (aCodec.channels !== bCodec.channels)
return false;
}
// TODO: Check H264 parameters.
// Match H264 parameters.
if (aName === 'h264')
{
const aPacketizationMode = (aCodec.parameters || {})['packetization-mode'] || 0;
const bPacketizationMode = (bCodec.parameters || {})['packetization-mode'] || 0;
if (aPacketizationMode !== bPacketizationMode)
return false;
}
return true;
}
function matchHeaderExtensions(extA, extB, leftIsParam = false)
function matchHeaderExtensions(aExt, bExt)
{
if (!leftIsParam)
{
if (extA.kind !== extB.kind)
return false;
}
if (aExt.kind && bExt.kind && aExt.kind !== bExt.kind)
return false;
if (extA.uri !== extB.uri)
if (aExt.uri !== bExt.uri)
return false;
return true;
......
......@@ -173,7 +173,7 @@ const supportedRtpCapabilities =
clockRate : 90000,
parameters :
{
packetizationMode : 0
'packetization-mode' : 0
},
rtcpFeedback :
[
......@@ -195,7 +195,7 @@ const supportedRtpCapabilities =
clockRate : 90000,
parameters :
{
packetizationMode : 1
'packetization-mode' : 1
},
rtcpFeedback :
[
......
......@@ -622,8 +622,7 @@ namespace RTC
if (consumer->kind == RTC::Media::Kind::VIDEO)
{
MS_DEBUG_TAG(
rtcp,
"requesting full frame for new Consumer since Transport already connected");
rtcp, "requesting full frame for new Consumer since Transport already connected");
}
consumer->RequestFullFrame();
......@@ -722,8 +721,7 @@ namespace RTC
this->iceServer->GetState() == RTC::IceServer::IceState::COMPLETED)
{
MS_DEBUG_TAG(
dtls,
"transition from DTLS local role 'auto' to 'server' and running DTLS transport");
dtls, "transition from DTLS local role 'auto' to 'server' and running DTLS transport");
this->dtlsLocalRole = RTC::DtlsTransport::Role::SERVER;
this->dtlsTransport->Run(RTC::DtlsTransport::Role::SERVER);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论