Bypassing Android audio decoder and pass stream to other device with decoder

775 views
Skip to first unread message

vinay pal

unread,
Nov 5, 2020, 10:52:47 AM11/5/20
to android-platform
Hello,
Please advise on following for my one of audio implementation

My system:
1. I have an android app to start streaming audio content from a url running (or local audio file) on DEVICE A.
2. The content uses specific codec and there is another connected device (DEVICE B) that has decoder/ Renderer and will feed to Amplifier/speakers.
3. The Android device A will send audio stream through Audio HAL implementations.

Question:
 1. How can I bypass Android audio decoder or Is there a way to configure Android to not decode the audio stream but send un-decoded stream to audio HAL?
 2. What area I need to modify to pass the un-decoded stream, Audio HAL? 

Any link and suggestions will be highly appreciated.

Thanks,
Vinay

Glenn Kasten

unread,
Nov 5, 2020, 11:30:33 AM11/5/20
to android-platform
Direct mode might do what you need. Here are some starting points to read.

vinay pal

unread,
Nov 9, 2020, 11:04:18 AM11/9/20
to android-platform
thanks Glenn for suggestion. I am checking these options.

VP

unread,
Dec 30, 2020, 4:11:34 PM12/30/20
to android-platform
Hello Glenn,

I tried to use Exoplayer in passthrough mode  for E-AC3 format.
And updated my audio_policy_configuration.xml.

But not get error in playback.

Source:

+               <mixPort name="mixport_bus8_out_direct" role="source"

+                         flags="AUDIO_OUTPUT_FLAG_DIRECT">

+                    <profile name="" format="AUDIO_FORMAT_E_AC3"

+                             samplingRates="48000"

+                             channelMasks="AUDIO_CHANNEL_OUT_5POINT1"/>

+                </mixPort>

Sink:

+               <devicePort tagName="bus8_out_direct" role="sink" type="AUDIO_DEVICE_OUT_BUS"

+                        address="bus8_out_direct">

+                    <profile name="" format="AUDIO_FORMAT_E_AC3"

+                            samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_5POINT1"/>

+                    <gains>

+                        <gain name="" mode="AUDIO_GAIN_MODE_JOINT"

+                                minValueMB="-3200" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>

+                    </gains>

+                </devicePort>

Route:

<route type="mix" sink="bus8_out_direct" sources="mixport_bus8_out_direct"/>


Logs:

 

12-11 18:26:10.462  6721  6721 D  SimpleExoPlayer:  SimpleExoPlayer builder.renderersFactory.createRenderers

12-11 18:26:10.467  6721  6721 D  DefaultRenderersFactory: buildAudioSink

12-11 18:26:10.468  6721  6721 D  AudioCapabilities: AudioCapabilities: supportedEncodings: 

12-11 18:26:10.469  6721  6721 D  AudioCapabilities: getCapabilities

12-11 18:26:10.469  6721  6721 D  DefaultRenderersFactory: AudioCapabilities.getCapabilities(context): AudioCapabilities[maxChannelCount=8, supportedEncodings=[2, 5, 6]]

12-11 18:26:10.481  6721  6721 D  DefaultRenderersFactory: createRenderers

12-11 18:26:10.482  6721  6721 D  DefaultRenderersFactory: createRenderers audioSink not null

12-11 18:26:10.482  6721  6721 D  DefaultRenderersFactory: buildAudioRenderers

12-11 18:26:10.663  6721  6757 D  AudioTrack: supportedEncoding : true

12-11 18:26:10.671  6721  6757 D  AudioTrack:  In audioCapabilities.supportsEncoding(encoding) 

12-11 18:26:10.672  6721  6757 D  MediaCodecAudioRenderer: onOutputFormatChanged

12-11 18:26:10.672  6721  6757 D  AudioTrack: (inputFormat.sampleMimeType: audio/eac3

12-11 18:26:10.673  6721  6757 D  AudioTrack: outputMode = OUTPUT_MODE_PASSTHROUGH;

12-11 18:26:10.673  6721  6757 D  AudioTrack: supportedEncoding : true

12-11 18:26:10.673  6721  6757 D  AudioTrack:  In audioCapabilities.supportsEncoding(encoding) 

 

 

12-11 18:26:10.681  2346  3051 W APM_AudioPolicyManager: getOutputForDevice() could not find output for stream 3, sampling rate 48000, format 0xa000000, channels 0x3f, flags 0x1

 

12-11 18:26:10.681  2346  3051 E AudioFlinger: createTrack() getOutputForAttr() return error -38 or invalid output handle

12-11 18:26:10.682  6721  6757 E IAudioFlinger: createTrack returned error -38

12-11 18:26:10.682  6721  6757 E AudioTrack: AudioFlinger could not create track, status: -38 output -565504656

12-11 18:26:10.683  6721  6757 E AudioTrack-JNI: Error -38 initializing AudioTrack

12-11 18:26:10.683  6721  6757 D AudioTrack: no metrics gathered, track status=-38

12-11 18:26:10.683  6721  6757 E android.media.AudioTrack: Error code -20 when initializing AudioTrack.

 

Reply all
Reply to author
Forward
0 new messages