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

H264 stuff (debugging)

上级 428bf2bc
...@@ -18,79 +18,6 @@ namespace RTC ...@@ -18,79 +18,6 @@ namespace RTC
if (len < 2) if (len < 2)
return nullptr; return nullptr;
// TODO <TPM>
uint8_t kk_nal = *data & 0x1F;
if (kk_nal != 1 && kk_nal != 28)
MS_ERROR(" *** [nal:%" PRIu8 "]", kk_nal);
switch (kk_nal)
{
// Single NAL unit packet.
// IDR (instantaneous decoding picture).
case 7:
{
MS_ERROR("<H264>");
MS_ERROR(" [nal:7]");
MS_ERROR("</H264>");
break;
}
// Aggreation packet.
// STAP-A.
case 24:
{
MS_ERROR("<H264>");
MS_ERROR(" [nal:24]");
size_t offset{ 1 };
len -= 1;
// Iterate NAL units.
while (len >= 3)
{
auto naluSize = Utils::Byte::Get2Bytes(data, offset);
uint8_t kk_subnal = *(data + offset + sizeof(naluSize)) & 0x1F;
MS_ERROR(" [subnal:%" PRIu8 "]", kk_subnal);
// Check if there is room for the indicated NAL unit size.
if (len < (naluSize + sizeof(naluSize)))
break;
offset += naluSize + sizeof(naluSize);
len -= naluSize + sizeof(naluSize);
}
MS_ERROR("</H264>");
break;
}
// Aggreation packet.
// FU-A, FU-B.
case 28:
case 29:
{
uint8_t subnal = *(data + 1) & 0x1F;
uint8_t startBit = *(data + 1) & 0x80;
if (kk_nal != 28 && startBit != 0)
{
MS_ERROR("<H264>");
MS_ERROR(" [nal:%" PRIu8 "]", kk_nal);
MS_ERROR(" [subnal:%" PRIu8 ", startBit:%" PRIu8 "]", subnal, startBit);
MS_ERROR("</H264>");
}
break;
}
}
// TODO </TPM>
uint8_t nal = *data & 0x1F; uint8_t nal = *data & 0x1F;
switch (nal) switch (nal)
...@@ -99,9 +26,9 @@ namespace RTC ...@@ -99,9 +26,9 @@ namespace RTC
// IDR (instantaneous decoding picture). // IDR (instantaneous decoding picture).
case 7: case 7:
{ {
payloadDescriptor->isKeyFrame = true; MS_ERROR("H264: ***KEYFRAME*** [nal:7]");
MS_ERROR("------------------------ keyframe: nal = 7"); payloadDescriptor->isKeyFrame = true;
break; break;
} }
...@@ -117,15 +44,14 @@ namespace RTC ...@@ -117,15 +44,14 @@ namespace RTC
// Iterate NAL units. // Iterate NAL units.
while (len >= 3) while (len >= 3)
{ {
auto naluSize = Utils::Byte::Get2Bytes(data, offset); auto naluSize = Utils::Byte::Get2Bytes(data, offset);
uint8_t subnal = *(data + offset + sizeof(naluSize)) & 0x1F;
nal = *(data + offset + sizeof(naluSize)) & 0x1F;
if (nal == 7) if (subnal == 7 || subnal == 8)
{ {
payloadDescriptor->isKeyFrame = true; MS_ERROR("H264: ***KEYFRAME*** [nal:24, subnal:%" PRIu8 "]", subnal);
MS_ERROR("------------------------ keyframe: nal = 24 (STAP-A)"); payloadDescriptor->isKeyFrame = true;
break; break;
} }
...@@ -146,14 +72,14 @@ namespace RTC ...@@ -146,14 +72,14 @@ namespace RTC
case 28: case 28:
case 29: case 29:
{ {
nal = *(data + 1) & 0x1F; uint8_t subnal = *(data + 1) & 0x1F;
uint8_t startBit = *(data + 1) & 0x80; uint8_t startBit = *(data + 1) & 0x80;
if (nal == 7 && startBit == 128) if ((subnal == 7 || subnal == 8) && startBit == 128)
{ {
payloadDescriptor->isKeyFrame = true; MS_ERROR("H264: ***KEYFRAME*** [nal:%" PRIu8 ", subnal:%" PRIu8 ", startBit:%" PRIu8 "]", nal, subnal, startBit);
MS_ERROR("------------------------ keyframe: nal = 27|28 (STAP-A). startBit:%" PRIu8, startBit); payloadDescriptor->isKeyFrame = true;
} }
break; break;
...@@ -168,7 +94,7 @@ namespace RTC ...@@ -168,7 +94,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
MS_DEBUG_DEV("<PayloadDescriptor>"); MS_DEBUG_DEV("<PayloadDescriptor>");
MS_DEBUG_DEV(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false"); MS_DEBUG_DEV(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
MS_DEBUG_DEV("</PayloadDescriptor>"); MS_DEBUG_DEV("</PayloadDescriptor>");
} }
......
...@@ -287,8 +287,6 @@ namespace RTC ...@@ -287,8 +287,6 @@ namespace RTC
) )
// clang-format on // clang-format on
{ {
MS_ERROR("--- MayChangeLayers() !!!");
MayChangeLayers(); MayChangeLayers();
} }
} }
...@@ -589,11 +587,6 @@ namespace RTC ...@@ -589,11 +587,6 @@ namespace RTC
if (this->keyFrameSupported && !packet->IsKeyFrame()) if (this->keyFrameSupported && !packet->IsKeyFrame())
return; return;
MS_ERROR(
"calling UpdateCurrentLayer [new spatial layer:%" PRIu16 ", isKeyFrame:%s]",
spatialLayer,
packet->IsKeyFrame() ? "true" : "false");
// Update current spatial and temporal layers. // Update current spatial and temporal layers.
UpdateCurrentLayers(); UpdateCurrentLayers();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论