Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LiveEffect] Error on a Nexus 5 running Android 5.1.1 #204

Closed
vbarthel-fr opened this issue Sep 3, 2018 · 2 comments
Closed

[LiveEffect] Error on a Nexus 5 running Android 5.1.1 #204

vbarthel-fr opened this issue Sep 3, 2018 · 2 comments

Comments

@vbarthel-fr
Copy link
Contributor

When I run the LiveEffect demo on a Nexus 5 running Android 5.1.1, there is no audio output and an error from the libOpenSLES can be observed in the logs:

9-03 13:29:06.465 26360-26360/? D/com.google.sample.oboe.liveEffect.MainActivity: Attempting to start
09-03 13:29:06.468 26360-26360/? I/OboeAudio: AudioStreamOpenSLES::open(chans:2, rate:0)
09-03 13:29:06.471 26360-26360/? D/OboeAudio: AudioStreamOpenSLES(): mFramesPerCallback = 192
    AudioStreamOpenSLES(): mBytesPerCallback = 768
09-03 13:29:06.474 26360-26360/? W/OboeAudio: configurePerformanceMode() not supported until N_MR1
09-03 13:29:06.475 26360-26360/? W/AUDIO-APP: Stream is NOT low latency.Check your requested format, sample rate and channel count
09-03 13:29:06.475 26360-26360/? I/OboeAudio: AudioStreamOpenSLES::open(chans:2, rate:48000)
09-03 13:29:06.475 26360-26360/? D/OboeAudio: AudioStreamOpenSLES(): mFramesPerCallback = 192
    AudioStreamOpenSLES(): mBytesPerCallback = 768
09-03 13:29:06.475 26360-26360/? E/libOpenSLES: Cannot create AudioRecorder: data sink must be in PCM format
    Cannot create AudioRecorder: invalid source or sink
09-03 13:29:06.475 26360-26360/? W/libOpenSLES: Leaving Engine::CreateAudioRecorder (SL_RESULT_PARAMETER_INVALID)
09-03 13:29:06.475 26360-26360/? E/OboeAudio: createAudioRecorder() result:SL_RESULT_PARAMETER_INVALID
09-03 13:29:06.475 26360-26360/? E/AUDIO-APP: Failed to create recording stream. Error: ErrorInternal
    Failed to create recording (0x0) and/or playback (0xb4894e00) stream

The issue seems to be related to the SL_ANDROID_DATAFORMAT_PCM_EX format: in the AudioInputStreamOpenSLES.cpp file, in the AudioInputStreamOpenSLES::open() method implementation, the SLAndroidDataFormat_PCM_EX format is forced on device with a SDK version >= than __ANDROID_API_L__. If I comment those lines, there are no error logs and the LiveEffect seems to work as expected.

AudioInputStreamOpenSLES.cpp (line from 103 to 116)

    /**
     * API 21 (Lollipop) introduced support for floating-point data representation and an extended
     * data format type: SLAndroidDataFormat_PCM_EX. If running on API 21+ use this newer format
     * type, creating it from our original format.
     */

    // SLAndroidDataFormat_PCM_EX format_pcm_ex;
    // if (getSdkVersion() >= __ANDROID_API_L__) {
    //     SLuint32 representation = OpenSLES_ConvertFormatToRepresentation(getFormat());
    //     // Fill in the format structure.
    //     format_pcm_ex = OpenSLES_createExtendedFormat(format_pcm, representation);
    //     // Use in place of the previous format.
    //     audioSink.pFormat = &format_pcm_ex;
    // }

Here are the logs when the SLAndroidDataFormat_PCM_EX code is commented:

09-03 13:37:40.346 27619-27619/com.google.sample.oboe.liveeffect D/com.google.sample.oboe.liveEffect.MainActivity: Attempting to start
09-03 13:37:40.350 27619-27619/com.google.sample.oboe.liveeffect I/OboeAudio: AudioStreamOpenSLES::open(chans:2, rate:0)
09-03 13:37:40.351 27619-27619/com.google.sample.oboe.liveeffect D/OboeAudio: AudioStreamOpenSLES(): mFramesPerCallback = 192
    AudioStreamOpenSLES(): mBytesPerCallback = 768
09-03 13:37:40.355 27619-27619/com.google.sample.oboe.liveeffect W/OboeAudio: configurePerformanceMode() not supported until N_MR1
09-03 13:37:40.358 27619-27619/com.google.sample.oboe.liveeffect W/AUDIO-APP: Stream is NOT low latency.Check your requested format, sample rate and channel count
09-03 13:37:40.358 27619-27619/com.google.sample.oboe.liveeffect I/OboeAudio: AudioStreamOpenSLES::open(chans:2, rate:48000)
09-03 13:37:40.358 27619-27619/com.google.sample.oboe.liveeffect D/OboeAudio: AudioStreamOpenSLES(): mFramesPerCallback = 192
    AudioStreamOpenSLES(): mBytesPerCallback = 768
09-03 13:37:40.358 27619-27619/com.google.sample.oboe.liveeffect W/OboeAudio: configurePerformanceMode() not supported until N_MR1
09-03 13:37:40.363 27619-27619/com.google.sample.oboe.liveeffect D/OboeAudio: FifoProcessor: capacityInFrames = 3072, bytesPerFrame = 4
09-03 13:37:40.363 27619-27619/com.google.sample.oboe.liveeffect W/AUDIO-APP: Stream is NOT low latency.Check your requested format, sample rate and channel count
09-03 13:37:40.363 27619-27619/com.google.sample.oboe.liveeffect D/OboeAudio: AudioInputStreamOpenSLES::requestStart()
    AudioInputStreamOpenSLES::setRecordState(3)
09-03 13:37:40.365 27619-27619/com.google.sample.oboe.liveeffect D/OboeAudio: AudioOutputStreamOpenSLES(): requestStart()
    AudioOutputStreamOpenSLES(): setPlayState()
09-03 13:37:40.444 27619-27894/com.google.sample.oboe.liveeffect D/OboeAudio: AudioStream::fireCallback() scheduler = SCHED_FIFO
09-03 13:37:40.477 27619-27619/com.google.sample.oboe.liveeffect D/OboeAudio: AudioStream::fireCallback() scheduler = SCHED_OTHER
09-03 13:37:40.477 27619-27893/com.google.sample.oboe.liveeffect D/OboeAudio: AudioStream::fireCallback() scheduler = SCHED_FIFO

Here are more details about the phone:

@vbarthel-fr
Copy link
Contributor Author

My bad, seems like a duplicate of the issue #192

@vbarthel-fr
Copy link
Contributor Author

I'm closing this since it's a duplicate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant