mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 21:40:20 +00:00
video lavd: skip leading AUD NALU for H.264
H264_mf encoder (Windows) produces single byte AUD unit prior to SPS NALU. Because only first NALU was evaluated to assess whether to pass the frame further, it took 10 frames (+ additional 10 for probe) before decoding started before it surrendered the checks.
This commit is contained in:
@@ -356,6 +356,8 @@ get_nalu_name(int type)
|
|||||||
return "H264 SEI";
|
return "H264 SEI";
|
||||||
case NAL_SPS:
|
case NAL_SPS:
|
||||||
return "H264 SPS";
|
return "H264 SPS";
|
||||||
|
case NAL_AUD:
|
||||||
|
return "H264 AUD";
|
||||||
case NAL_HEVC_VPS:
|
case NAL_HEVC_VPS:
|
||||||
return "HEVC VPS";
|
return "HEVC VPS";
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ enum {
|
|||||||
NAL_IDR = 5,
|
NAL_IDR = 5,
|
||||||
NAL_SEI = 6,
|
NAL_SEI = 6,
|
||||||
NAL_SPS = 7,
|
NAL_SPS = 7,
|
||||||
|
NAL_AUD = 9,
|
||||||
NAL_MAX = 23,
|
NAL_MAX = 23,
|
||||||
// HEVC
|
// HEVC
|
||||||
NAL_HEVC_VPS = 32,
|
NAL_HEVC_VPS = 32,
|
||||||
|
|||||||
@@ -806,16 +806,22 @@ static _Bool check_first_sps_vps(struct state_libavcodec_decompress *s, unsigned
|
|||||||
s->sps_vps_found = 1;
|
s->sps_vps_found = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const unsigned char *first_nal = rtpenc_h264_get_next_nal(src, src_len, NULL);
|
|
||||||
if (!first_nal) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int nalu_type = 0;
|
int nalu_type = 0;
|
||||||
if (s->desc.color_spec == H264) {
|
const unsigned char *nal = src;
|
||||||
nalu_type = NALU_HDR_GET_TYPE(first_nal[0]);
|
do {
|
||||||
} else {
|
nal =
|
||||||
nalu_type = first_nal[0] >> 1;
|
rtpenc_h264_get_next_nal(nal, src_len - (nal - src), NULL);
|
||||||
}
|
if (!nal) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (s->desc.color_spec == H264) {
|
||||||
|
nalu_type = NALU_HDR_GET_TYPE(nal[0]);
|
||||||
|
} else {
|
||||||
|
nalu_type = nal[0] >> 1;
|
||||||
|
}
|
||||||
|
debug_msg("Received %s NALU.", get_nalu_name(nalu_type));
|
||||||
|
} while (nalu_type == NAL_AUD);
|
||||||
|
|
||||||
switch (nalu_type) {
|
switch (nalu_type) {
|
||||||
case NAL_SPS:
|
case NAL_SPS:
|
||||||
|
|||||||
Reference in New Issue
Block a user