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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

vinay pal
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

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/243a51f0-1029-4a67-bfc8-9ade261a4cdan%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

Glenn Kasten
Direct mode might do what you need. Here are some starting points to read.
See https://developer.android.com/reference/android/media/AudioTrack#isDirectPlaybackSupported(android.media.AudioFormat,%20android.media.AudioAttributes)
and https://developer.android.com/reference/android/media/AudioFormat
paragraphs "For compressed audio ..." and "When compressed audio ..."
and section "Audio Frame".


On Thursday, November 5, 2020 at 7:52:47 AM UTC-8, vinay pal wrote:
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

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/ab4ec8a0-02f2-4bf1-8117-1f658937d980o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

vinay pal
thanks Glenn for suggestion. I am checking these options.

On Thursday, November 5, 2020 at 8:30:33 AM UTC-8 Glenn Kasten wrote:
Direct mode might do what you need. Here are some starting points to read.


On Thursday, November 5, 2020 at 7:52:47 AM UTC-8, vinay pal wrote:
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

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/14520b04-7a0e-4a2a-8e50-ad6f0673809cn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

vinay pal
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.

 

On Monday, November 9, 2020 at 8:04:18 AM UTC-8 VP wrote:
thanks Glenn for suggestion. I am checking these options.

On Thursday, November 5, 2020 at 8:30:33 AM UTC-8 Glenn Kasten wrote:
Direct mode might do what you need. Here are some starting points to read.


On Thursday, November 5, 2020 at 7:52:47 AM UTC-8, vinay pal wrote:
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

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/efebbab4-6da1-4417-8f08-30e649150e4an%40googlegroups.com.