You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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:The issue seems to be related to the
SL_ANDROID_DATAFORMAT_PCM_EX
format: in theAudioInputStreamOpenSLES.cpp
file, in theAudioInputStreamOpenSLES::open()
method implementation, theSLAndroidDataFormat_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)Here are the logs when the
SLAndroidDataFormat_PCM_EX
code is commented:Here are more details about the phone:
The text was updated successfully, but these errors were encountered: