Reputation: 2223
I am trying to decode AC3 audio with the Android MediaCodec API. I can successfully decode AAC provided I set csd-0
to the elementary stream descriptor.
Attempting to decode AC3, I use the following MediaFormat in my configuration:
AMEDIAFORMAT_KEY_MIME: "audio/ac3"
AMEDIAFORMAT_KEY_CHANNEL_COUNT: 6
AMEDIAFORMAT_KEY_SAMPLE_RATE: 48000
AMEDIAFORMAT_KEY_IS_ADTS: 0
On the call to AMediaCodec_configure
I get the following error messages:
01-22 12:37:58.760: E/ACodec(10548): [OMX.Nvidia.bypass.decoder] configureCodec returning error -2147483648
01-22 12:37:58.760: E/ACodec(10548): signalError(omxError 0x80001001, internalError -2147483648)
01-22 12:37:58.760: E/MediaCodec(10548): Codec reported err 0x80001001, actionCode 0, while in state 3
01-22 12:37:58.760: E/MediaCodec(10548): configure failed with err 0x80001001, resetting...
Is there some extra data I need to provide the decoder? I am unfamiliar with the AC3 standard, perhaps there is an equivalent to the elementary stream descriptor that must be provided in csd-0
?
Upvotes: 1
Views: 2673
Reputation: 13317
There is no official spec on how to handle AC-3 in OpenMAX IL (which is the standard used internally beneath MediaCodec), but despite this, some manufacturers do expose such decoders.
I have earlier tried to do such decoding on a Samsung Galaxy S3, where it did seem to work, and I didn't need to pass any extra data. See https://github.com/mstorsjo/vlc/commit/omxil-ac3 for info about this experiment.
I don't know if this particular Nvidia decoder behaves differently, or if there is something else missing on the ACodec/MediaCodec levels inbetween, that makes it impossible to use. (The example above used internal OMX APIs directly, from before MediaCodec was available.) To complete the answer, I guess I should retest the experiment on the Galaxy S3, both via OMX directly and via MediaCodec, and then on a Nvidia device (is this a Nexus 9 that you're testing on, or something else?).
Upvotes: 2