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

H264: Ugly logs for testing

上级 dfb224ef
......@@ -18,6 +18,79 @@ namespace RTC
if (len < 2)
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;
switch (nal)
......@@ -28,7 +101,7 @@ namespace RTC
{
payloadDescriptor->isKeyFrame = true;
MS_ERROR("keyframe: nal = 7");
MS_ERROR("------------------------ keyframe: nal = 7");
break;
}
......@@ -52,7 +125,7 @@ namespace RTC
{
payloadDescriptor->isKeyFrame = true;
MS_ERROR("keyframe: nal = 24 (STAP-A)");
MS_ERROR("------------------------ keyframe: nal = 24 (STAP-A)");
break;
}
......@@ -80,7 +153,7 @@ namespace RTC
{
payloadDescriptor->isKeyFrame = true;
MS_ERROR("keyframe: nal = 27|28 (STAP-A). startBit:%" PRIu8, startBit);
MS_ERROR("------------------------ keyframe: nal = 27|28 (STAP-A). startBit:%" PRIu8, startBit);
}
break;
......
......@@ -287,6 +287,8 @@ namespace RTC
)
// clang-format on
{
MS_ERROR("--- MayChangeLayers() !!!");
MayChangeLayers();
}
}
......@@ -587,12 +589,10 @@ namespace RTC
if (this->keyFrameSupported && !packet->IsKeyFrame())
return;
MS_ERROR(
"calling UpdateCurrentLayer [currentSpatialLayer:%" PRIu16 ", targetSpatialLayer:%" PRIu16
", isKeyFrame:%s]",
this->currentSpatialLayer,
this->targetSpatialLayer,
packet->IsKeyFrame() ? "true" : "false");
MS_ERROR(
"calling UpdateCurrentLayer [new spatial layer:%" PRIu16 ", isKeyFrame:%s]",
spatialLayer,
packet->IsKeyFrame() ? "true" : "false");
// Update current spatial and temporal layers.
UpdateCurrentLayers();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论