Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/opensles/AudioStreamOpenSLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ using namespace oboe;

AudioStreamOpenSLES::AudioStreamOpenSLES(const AudioStreamBuilder &builder)
: AudioStreamBuffered(builder) {
// OpenSL ES does not support device IDs. So overwrite value from builder.
mDeviceIds.clear();
// OpenSL ES does not support session IDs. So overwrite value from builder.
mSessionId = SessionId::None;
// Device ID and session ID are deliberately not reset here. They are read from the
// builder during open() to configure the stream, e.g. to select the performance mode,
// and to log unsupported attributes. They are reset in finishCommonOpen().
}

static constexpr int32_t kHighLatencyBufferSizeMillis = 20; // typical Android period
Expand Down Expand Up @@ -114,6 +113,13 @@ SLresult AudioStreamOpenSLES::finishCommonOpen(SLAndroidConfigurationItf configI
// Spatialization Behavior is not supported for OpenSL ES.
mSpatializationBehavior = SpatializationBehavior::Never;

// Device ID and session ID are not supported for OpenSL ES. They are only used during
// open() to configure the stream and to log unsupported attributes, so they are reset
// here once the stream has been configured. This also keeps getDeviceId() and
// getSessionId() from reporting attributes that OpenSL ES does not actually provide.
mDeviceIds.clear();
mSessionId = SessionId::None;

SLresult result = registerBufferQueueCallback();
if (SL_RESULT_SUCCESS != result) {
return result;
Expand Down