ffdec_aac: Do not parse raw format

If the stream is 'raw' format, do not use parsers.
Re-enables the aac decoder by putting it back to default
ffdec rank.

Fixes #566250
This commit is contained in:
Thiago Santos 2010-03-08 15:00:05 -03:00
parent d0ac5265fa
commit c300a0a9f2

View file

@ -126,6 +126,8 @@ struct _GstFFMpegDec
gboolean has_b_frames; gboolean has_b_frames;
/* parsing */ /* parsing */
gboolean turnoff_parser; /* used for turning off aac raw parsing
* See bug #566250 */
AVCodecParserContext *pctx; AVCodecParserContext *pctx;
GstBuffer *pcache; GstBuffer *pcache;
guint8 *padded; guint8 *padded;
@ -647,11 +649,15 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
ffmpegdec->is_realvideo = TRUE; ffmpegdec->is_realvideo = TRUE;
break; break;
default: default:
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id); if (!ffmpegdec->turnoff_parser) {
if (ffmpegdec->pctx) ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx); if (ffmpegdec->pctx)
else GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx);
GST_LOG_OBJECT (ffmpegdec, "No parser for codec"); else
GST_LOG_OBJECT (ffmpegdec, "No parser for codec");
} else {
GST_LOG_OBJECT (ffmpegdec, "Parser deactivated for format");
}
break; break;
} }
@ -729,6 +735,9 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
ffmpegdec->context->release_buffer = gst_ffmpegdec_release_buffer; ffmpegdec->context->release_buffer = gst_ffmpegdec_release_buffer;
ffmpegdec->context->draw_horiz_band = NULL; ffmpegdec->context->draw_horiz_band = NULL;
/* default is to let format decide if it needs a parser */
ffmpegdec->turnoff_parser = FALSE;
/* assume PTS as input, we will adapt when we detect timestamp reordering /* assume PTS as input, we will adapt when we detect timestamp reordering
* in the output frames. */ * in the output frames. */
ffmpegdec->ts_is_dts = FALSE; ffmpegdec->ts_is_dts = FALSE;
@ -813,6 +822,15 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE; ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
} }
/* for AAC we only use av_parse if not on raw caps */
if (oclass->in_plugin->id == CODEC_ID_AAC) {
const gchar *format = gst_structure_get_string (structure, "stream-format");
if (format == NULL || strcmp (format, "raw") == 0) {
ffmpegdec->turnoff_parser = TRUE;
}
}
/* workaround encoder bugs */ /* workaround encoder bugs */
ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT; ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
ffmpegdec->context->error_recognition = 1; ffmpegdec->context->error_recognition = 1;
@ -2904,12 +2922,6 @@ gst_ffmpegdec_register (GstPlugin * plugin)
note: if you change this, see the code in gstdv.c in good/ext/dv. */ note: if you change this, see the code in gstdv.c in good/ext/dv. */
rank = GST_RANK_SECONDARY; rank = GST_RANK_SECONDARY;
break; break;
case CODEC_ID_AAC:
/* The ffmpeg AAC decoder isn't complete, and there's no way to figure out
* before decoding whether it will support the given stream or not.
* We therefore set it to NONE until it can handle the full specs. */
rank = GST_RANK_NONE;
break;
default: default:
rank = GST_RANK_MARGINAL; rank = GST_RANK_MARGINAL;
break; break;