Fix SL_ANDROID_PERFORMANCE_LATENCY_EFFECTS not usable on OpenSL ES streams - #2411
Draft
rootkiller6788 wants to merge 1 commit into
Draft
Fix SL_ANDROID_PERFORMANCE_LATENCY_EFFECTS not usable on OpenSL ES streams#2411rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
…reams The OpenSL ES stream constructor cleared the device ID and session ID requested by the app before AudioStreamOpenSLES::open() could use them. Because mSessionId was always reset to SessionId::None in the constructor, convertPerformanceMode() could never select SL_ANDROID_PERFORMANCE_LATENCY_EFFECTS for a LowLatency stream that also requested a session ID, leaving that branch unreachable. Similarly, logUnsupportedAttributes() never reported that device IDs and session IDs are not supported on OpenSL ES, because both were cleared before it ran. Keep the builder's values during open() so the performance mode and the unsupported-attribute warnings are computed correctly, then reset them in finishCommonOpen(), which runs after the stream has been configured. This also keeps getDeviceId() and getSessionId() from reporting attributes that OpenSL ES does not actually provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2392.
Problem
OpenSL ES streams force
mSessionId = SessionId::NoneandmDeviceIds.clear()in the constructor, beforeopen()runs. This makes two code paths inAudioStreamOpenSLESunreachable:SL_ANDROID_PERFORMANCE_LATENCY_EFFECTScan never be selected.convertPerformanceMode()mapsPerformanceMode::LowLatencytoSL_ANDROID_PERFORMANCE_LATENCY_EFFECTSwhengetSessionId() != SessionId::None, but since the session ID was always reset toNonein the constructor, the condition was always false and onlySL_ANDROID_PERFORMANCE_LATENCYwas ever used.logUnsupportedAttributes()never warns about device IDs or session IDs on OpenSL ES, because both had already been cleared before it ran.Fix
Keep the builder's device ID and session ID during
open(), then reset them infinishCommonOpen(), which runs afterconfigurePerformanceMode()on both the output (AudioOutputStreamOpenSLES::open()) and input (AudioInputStreamOpenSLES::open()) paths. This:convertPerformanceMode()reach theSL_ANDROID_PERFORMANCE_LATENCY_EFFECTSbranch, so apps can opt into HW pre/post processing on a low-latency OpenSL ES stream,logUnsupportedAttributes()functional,getDeviceId()/getSessionId()report no device/session (OpenSL ES does not actually provide them).