Skip to content

Commit

Permalink
h264: merge old and new "slice in extradata" checks
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Dec 18, 2012
1 parent 09b4ae8 commit 99321d1
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions libavcodec/h264.c
Expand Up @@ -3924,32 +3924,24 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
continue;

again:
/* Ignore every NAL unit type except PPS and SPS during extradata
/* Ignore per frame NAL unit type during extradata
* parsing. Decoding slices is not possible in codec init
* with frame-mt */
if (parse_extradata && HAVE_THREADS &&
(s->avctx->active_thread_type & FF_THREAD_FRAME) &&
(hx->nal_unit_type != NAL_PPS &&
hx->nal_unit_type != NAL_SPS)) {
av_log(avctx, AV_LOG_INFO, "Ignoring NAL unit %d during "
"extradata parsing\n", hx->nal_unit_type);
hx->nal_unit_type = NAL_FF_IGNORE;
}
err = 0;

if (h->decoding_extradata) {
if (parse_extradata) {
switch (hx->nal_unit_type) {
case NAL_IDR_SLICE:
case NAL_SLICE:
case NAL_DPA:
case NAL_DPB:
case NAL_DPC:
case NAL_AUXILIARY_SLICE:
av_log(h->s.avctx, AV_LOG_WARNING, "Ignoring NAL %d in global header\n", hx->nal_unit_type);
hx->nal_unit_type = NAL_FILLER_DATA;
av_log(h->s.avctx, AV_LOG_WARNING, "Ignoring NAL %d in global header/extradata\n", hx->nal_unit_type);
hx->nal_unit_type = NAL_FF_IGNORE;
}
}

err = 0;

switch (hx->nal_unit_type) {
case NAL_IDR_SLICE:
if (first_slice != NAL_IDR_SLICE) {
Expand Down

0 comments on commit 99321d1

Please sign in to comment.