amcaudiodec error: 'first buffer should have OMX_BUFFERFLAG_CODECCONFIG set'
Submitted by Jonas Larsson
Link to original bug (#740101)
Description
Created attachment 290679
gst logs
Environment: Google Nexus 9, Android 5.0 (L), non custom factory image, official 1.4.4 Android debug binaries
App: Unmodified gst sdk tutorial 5
Error description:
Tested out the latest Android binaries for kicks, fail to play back lots of streams.
11-13 17:33:16.110 5481 5773 D GStreamer+amcaudiodec: 0:26:00.482850462 0xab9894f0 gstamcaudiodec.c:775:gst_amc_audio_dec_set_format:<amcaudiodec-omxgoogleaacdecoder2>
Setting new caps audio/mpeg, framed=(boolean)true, mpegversion=(int)4, level=(string)1, base-profile=(string)lc, profile=(string)lc, rate=(int)24000, channels=(int)2, stream-format=(string)adts
11-13 17:33:16.110 5481 5773 D GStreamer+amcaudiodec: 0:26:00.482993212 0xab9894f0 gstamcaudiodec.c:891:gst_amc_audio_dec_set_format:<amcaudiodec-omxgoogleaacdecoder2>
Configuring codec with format: {channel-count=2, mime=audio/mp4a-latm, sample-rate=24000}
11-13 17:33:16.118 5481 5777 E SoftAAC2: first buffer should have OMX_BUFFERFLAG_CODECCONFIG set
11-13 17:33:16.118 5481 5777 W SoftAAC2: aacDecoder_ConfigRaw decoderErr = 0x2003
11-13 17:33:16.118 5481 5776 E ACodec : [OMX.google.aac.decoder] ERROR(0x80001001)
11-13 17:33:16.121 5481 5779 E GStreamer+amcaudiodec: 0:26:00.494109128 0xab7cb000 gstamcaudiodec.c:476:gst_amc_audio_dec_loop:<amcaudiodec-omxgoogleaacdecoder2>
Failure dequeueing output buffer
11-13 17:33:16.121 5481 5779 W GStreamer+amcaudiodec: 0:26:00.494204545 0xab7cb000 gstamcaudiodec.c:590:gst_amc_audio_dec_loop:<amcaudiodec-omxgoogleaacdecoder2>
error: Failed to dequeue output buffer: java.lang.IllegalStateException
More complete log and media sample attached.
It appears that amcaudiodec advertises support for AAC in adts format. aacparse isn't producing any "codec_data" or "stream_header" so no "csd-0" parameter is set. Furthermore, the equivalent of
mediaFormat.setInteger(MediaFormat.KEY_IS_ADTS, 1);
isn't done either. MediaCodec therefore assumes raw AAC and expects the first buffer to contain ESDS and have the flag MediaCodec.BUFFER_FLAG_CODEC_CONFIG set. When that's not the case, this error is thrown.
adts AAC streams are quite common so a bug like this is a blocker for broader adoption on Android (as is #731204
)
A workaround is to compile in faad which works perfectly.
(This is based on a one time reading of the code and logs, once I figure out how to actually build gst for android without cerbero failing left and right on my 64 bit system looking for 32 bit libs I may be able to offer more insight)
Attachment 290679, "gst logs":
gst_log.txt
Version: 1.4.4