formats: Fix the correct NAL types in h264 and h266

This fix revealed an error in h266 fragmentation which is not fixed.
This commit is contained in:
Joni Räsänen 2022-06-17 10:34:22 +03:00
parent b7ff2777b5
commit 6f39a4e138
2 changed files with 7 additions and 6 deletions

View File

@ -71,7 +71,7 @@ uvgrtp::formats::FRAG_TYPE uvgrtp::formats::h264::get_fragment_type(uvgrtp::fram
uvgrtp::formats::NAL_TYPE uvgrtp::formats::h264::get_nal_type(uvgrtp::frame::rtp_frame* frame) const
{
switch (frame->payload[1] & 0x1f) {
case 19: return uvgrtp::formats::NAL_TYPE::NT_INTRA;
case 5: return uvgrtp::formats::NAL_TYPE::NT_INTRA;
case 1: return uvgrtp::formats::NAL_TYPE::NT_INTER;
default: break;
}

View File

@ -76,11 +76,12 @@ uvgrtp::formats::FRAG_TYPE uvgrtp::formats::h266::get_fragment_type(uvgrtp::fram
uvgrtp::formats::NAL_TYPE uvgrtp::formats::h266::get_nal_type(uvgrtp::frame::rtp_frame* frame) const
{
switch (frame->payload[2] & 0x3f) {
case 19: return uvgrtp::formats::NAL_TYPE::NT_INTRA;
case 1: return uvgrtp::formats::NAL_TYPE::NT_INTER;
default: break;
}
uint8_t nal_type = frame->payload[2] & 0x3f;
if (nal_type == 7)
return uvgrtp::formats::NAL_TYPE::NT_INTRA;
else if (nal_type == 0)
return uvgrtp::formats::NAL_TYPE::NT_INTER;
return uvgrtp::formats::NAL_TYPE::NT_OTHER;
}