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