Loading media/libaaudio/src/legacy/AudioStreamRecord.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder) // Try to create an AudioRecord const aaudio_session_id_t requestedSessionId = builder.getSessionId(); const audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); // TODO Support UNSPECIFIED in AudioRecord. For now, use stereo if unspecified. int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED) ? 2 : getSamplesPerFrame(); Loading @@ -66,17 +69,21 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder) : builder.getBufferCapacity(); audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE; audio_input_flags_t flags; aaudio_performance_mode_t perfMode = getPerformanceMode(); switch (perfMode) { case AAUDIO_PERFORMANCE_MODE_LOW_LATENCY: flags = (audio_input_flags_t) (AUDIO_INPUT_FLAG_FAST | AUDIO_INPUT_FLAG_RAW); // If the app asks for a sessionId then it means they want to use effects. // So don't use RAW flag. flags = (audio_input_flags_t) ((requestedSessionId == AAUDIO_SESSION_ID_NONE) ? (AUDIO_INPUT_FLAG_FAST | AUDIO_INPUT_FLAG_RAW) : (AUDIO_INPUT_FLAG_FAST)); break; case AAUDIO_PERFORMANCE_MODE_POWER_SAVING: case AAUDIO_PERFORMANCE_MODE_NONE: default: // No flags. flags = AUDIO_INPUT_FLAG_NONE; break; } Loading Loading @@ -141,9 +148,6 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder) .tags = "" }; aaudio_session_id_t requestedSessionId = builder.getSessionId(); audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); // ----------- open the AudioRecord --------------------- // Might retry, but never more than once. for (int i = 0; i < 2; i ++) { Loading media/libaaudio/src/legacy/AudioStreamTrack.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -59,18 +59,25 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder) return result; } const aaudio_session_id_t requestedSessionId = builder.getSessionId(); const audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); // Try to create an AudioTrack // Use stereo if unspecified. int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED) ? 2 : getSamplesPerFrame(); audio_channel_mask_t channelMask = audio_channel_out_mask_from_count(samplesPerFrame); audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE; audio_output_flags_t flags; aaudio_performance_mode_t perfMode = getPerformanceMode(); switch(perfMode) { case AAUDIO_PERFORMANCE_MODE_LOW_LATENCY: // Bypass the normal mixer and go straight to the FAST mixer. flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW); // If the app asks for a sessionId then it means they want to use effects. // So don't use RAW flag. flags = (audio_output_flags_t) ((requestedSessionId == AAUDIO_SESSION_ID_NONE) ? (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW) : (AUDIO_OUTPUT_FLAG_FAST)); break; case AAUDIO_PERFORMANCE_MODE_POWER_SAVING: Loading @@ -81,6 +88,7 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder) case AAUDIO_PERFORMANCE_MODE_NONE: default: // No flags. Use a normal mixer in front of the FAST mixer. flags = AUDIO_OUTPUT_FLAG_NONE; break; } Loading Loading @@ -135,11 +143,6 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder) .tags = "" }; static_assert(AAUDIO_UNSPECIFIED == AUDIO_SESSION_ALLOCATE, "Session IDs should match"); aaudio_session_id_t requestedSessionId = builder.getSessionId(); audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); mAudioTrack = new AudioTrack(); mAudioTrack->set( AUDIO_STREAM_DEFAULT, // ignored because we pass attributes below Loading Loading
media/libaaudio/src/legacy/AudioStreamRecord.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder) // Try to create an AudioRecord const aaudio_session_id_t requestedSessionId = builder.getSessionId(); const audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); // TODO Support UNSPECIFIED in AudioRecord. For now, use stereo if unspecified. int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED) ? 2 : getSamplesPerFrame(); Loading @@ -66,17 +69,21 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder) : builder.getBufferCapacity(); audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE; audio_input_flags_t flags; aaudio_performance_mode_t perfMode = getPerformanceMode(); switch (perfMode) { case AAUDIO_PERFORMANCE_MODE_LOW_LATENCY: flags = (audio_input_flags_t) (AUDIO_INPUT_FLAG_FAST | AUDIO_INPUT_FLAG_RAW); // If the app asks for a sessionId then it means they want to use effects. // So don't use RAW flag. flags = (audio_input_flags_t) ((requestedSessionId == AAUDIO_SESSION_ID_NONE) ? (AUDIO_INPUT_FLAG_FAST | AUDIO_INPUT_FLAG_RAW) : (AUDIO_INPUT_FLAG_FAST)); break; case AAUDIO_PERFORMANCE_MODE_POWER_SAVING: case AAUDIO_PERFORMANCE_MODE_NONE: default: // No flags. flags = AUDIO_INPUT_FLAG_NONE; break; } Loading Loading @@ -141,9 +148,6 @@ aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder) .tags = "" }; aaudio_session_id_t requestedSessionId = builder.getSessionId(); audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); // ----------- open the AudioRecord --------------------- // Might retry, but never more than once. for (int i = 0; i < 2; i ++) { Loading
media/libaaudio/src/legacy/AudioStreamTrack.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -59,18 +59,25 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder) return result; } const aaudio_session_id_t requestedSessionId = builder.getSessionId(); const audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); // Try to create an AudioTrack // Use stereo if unspecified. int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED) ? 2 : getSamplesPerFrame(); audio_channel_mask_t channelMask = audio_channel_out_mask_from_count(samplesPerFrame); audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE; audio_output_flags_t flags; aaudio_performance_mode_t perfMode = getPerformanceMode(); switch(perfMode) { case AAUDIO_PERFORMANCE_MODE_LOW_LATENCY: // Bypass the normal mixer and go straight to the FAST mixer. flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW); // If the app asks for a sessionId then it means they want to use effects. // So don't use RAW flag. flags = (audio_output_flags_t) ((requestedSessionId == AAUDIO_SESSION_ID_NONE) ? (AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_RAW) : (AUDIO_OUTPUT_FLAG_FAST)); break; case AAUDIO_PERFORMANCE_MODE_POWER_SAVING: Loading @@ -81,6 +88,7 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder) case AAUDIO_PERFORMANCE_MODE_NONE: default: // No flags. Use a normal mixer in front of the FAST mixer. flags = AUDIO_OUTPUT_FLAG_NONE; break; } Loading Loading @@ -135,11 +143,6 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder) .tags = "" }; static_assert(AAUDIO_UNSPECIFIED == AUDIO_SESSION_ALLOCATE, "Session IDs should match"); aaudio_session_id_t requestedSessionId = builder.getSessionId(); audio_session_t sessionId = AAudioConvert_aaudioToAndroidSessionId(requestedSessionId); mAudioTrack = new AudioTrack(); mAudioTrack->set( AUDIO_STREAM_DEFAULT, // ignored because we pass attributes below Loading