audio: refine the period size for raw playback

For raw playback, the buffer size needs to equal to the
ring buffer size. AoC changes the buffer size to 16384 bytes,
but it cannot be divisible by 48(1ms frames with 48000 sample rate).
Use the period size(frame couts) from configuration file.

Bug: 194398677
Test: OboeTester->TEST OUTPUT
Change-Id: I07f0cb7d5904e4e3ef78b9a15d31590fdd5a9087
This commit is contained in:
millerliang 2021-07-27 15:41:35 +08:00 committed by Craig Dooley
parent 80f37d804a
commit 225b713e1e
4 changed files with 8 additions and 8 deletions

View file

@ -172,8 +172,8 @@
</input_backend_cfg_mic_mapping> </input_backend_cfg_mic_mapping>
<usecase_attr> <usecase_attr>
<!-- for output with AUDIO_OUTPUT_FLAG_RAW, 40 * 1ms buffer with 32-bit --> <!-- for output with AUDIO_OUTPUT_FLAG_RAW, 32 periods * 64 frames(around 1.3ms) * 2ch * 4(s32) = 16384 bytes -->
<usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="1" period_num="40"/> <usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="64" period_num="32"/>
<!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer --> <!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer -->
<usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/> <usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/>
<!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes --> <!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes -->

View file

@ -172,8 +172,8 @@
</input_backend_cfg_mic_mapping> </input_backend_cfg_mic_mapping>
<usecase_attr> <usecase_attr>
<!-- for output with AUDIO_OUTPUT_FLAG_RAW, 40 * 1ms buffer with 32-bit --> <!-- for output with AUDIO_OUTPUT_FLAG_RAW, 32 periods * 64 frames(around 1.3ms) * 2ch * 4(s32) = 16384 bytes -->
<usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="1" period_num="40"/> <usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="64" period_num="32"/>
<!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer --> <!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer -->
<usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/> <usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/>
<!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes --> <!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes -->

View file

@ -110,8 +110,8 @@
</input_backend_cfg_mic_mapping> </input_backend_cfg_mic_mapping>
<usecase_attr> <usecase_attr>
<!-- for output with AUDIO_OUTPUT_FLAG_RAW, 40 * 1ms buffer with 32-bit --> <!-- for output with AUDIO_OUTPUT_FLAG_RAW, 32 periods * 64 frames(around 1.3ms) * 2ch * 4(s32) = 16384 bytes -->
<usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="1" period_num="40"/> <usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="64" period_num="32"/>
<!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer --> <!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer -->
<usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/> <usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/>
<!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes --> <!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes -->

View file

@ -110,8 +110,8 @@
</input_backend_cfg_mic_mapping> </input_backend_cfg_mic_mapping>
<usecase_attr> <usecase_attr>
<!-- for output with AUDIO_OUTPUT_FLAG_RAW, 40 * 1ms buffer with 32-bit --> <!-- for output with AUDIO_OUTPUT_FLAG_RAW, 32 periods * 64 frames(around 1.3ms) * 2ch * 4(s32) = 16384 bytes -->
<usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="1" period_num="40"/> <usecase id="UC_RAW_PLAYBACK" dev1="23" dyn_path="true" dsp_vol="false" mmap="true" period="64" period_num="32"/>
<!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer --> <!-- for output with AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST, 4 * 10ms buffer -->
<usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/> <usecase id="UC_LOW_LATENCY_PLAYBACK" dev1="1" dyn_path="true" dsp_vol="false" mmap="false" period="10" period_num="4"/>
<!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes --> <!-- for output with AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 80 periods * 48 frames/period(=1ms w/ 48k sample rate) * 4 bytes/frame = 15360 bytes -->