Audio_stream: Add default byte and frame alignment set in init function

Set byte_align as 1 and frame_align as 1 means no limit on both byte and
frame for this stream. Call audio_stream_init_alignment_constants in
audio_stream_init, set default align info while buffer created. And every
specific component can set its own byte and frame align info in its
prepare function later.

Signed-off-by: Andrula Song <andrula.song@intel.com>
This commit is contained in:
Andrula Song 2023-04-21 17:25:12 +08:00 committed by Kai Vehmanen
parent d604a3242d
commit 88990a62ef
8 changed files with 18 additions and 0 deletions

View File

@ -561,6 +561,12 @@ static inline void audio_stream_init(struct audio_stream __sparse_cache *buffer,
buffer->size = size;
buffer->addr = buff_addr;
buffer->end_addr = (char *)buffer->addr + size;
/* set the default alignment info.
* set byte_align as 1 means no alignment limit on byte.
* set frame_align as 1 means no alignment limit on frame.
*/
audio_stream_init_alignment_constants(1, 1, buffer);
audio_stream_reset(buffer);
}

View File

@ -13,6 +13,7 @@ cmocka_test(buffer_copy
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-stream.c
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-xrun.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
)
cmocka_test(buffer_new
@ -29,6 +30,7 @@ cmocka_test(buffer_new
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-stream.c
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-xrun.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
)
cmocka_test(buffer_wrap
@ -45,6 +47,7 @@ cmocka_test(buffer_wrap
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-stream.c
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-xrun.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
)
cmocka_test(buffer_write
@ -61,4 +64,5 @@ cmocka_test(buffer_write
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-stream.c
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-xrun.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
)

View File

@ -2,6 +2,7 @@
cmocka_test(comp_set_state
comp_set_state.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/audio/data_blob.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc3/helper.c

View File

@ -3,6 +3,7 @@
if(CONFIG_FORMAT_FLOAT)
cmocka_test(pcm_float_generic
pcm_float.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
${PROJECT_SOURCE_DIR}/src/audio/pcm_converter/pcm_converter.c
${PROJECT_SOURCE_DIR}/src/audio/pcm_converter/pcm_converter_generic.c
${PROJECT_SOURCE_DIR}/src/audio/buffer.c

View File

@ -19,6 +19,7 @@ endif()
cmocka_test(pipeline_new
pipeline_new.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc3/helper.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc-common.c
@ -36,6 +37,7 @@ cmocka_test(pipeline_new
cmocka_test(pipeline_connect_upstream
pipeline_connect_upstream.c
pipeline_connection_mocks.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc3/helper.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc-common.c
@ -53,6 +55,7 @@ cmocka_test(pipeline_connect_upstream
cmocka_test(pipeline_free
pipeline_free.c
pipeline_connection_mocks.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc3/helper.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc-common.c

View File

@ -12,6 +12,7 @@ target_include_directories(selector_test PRIVATE ${PROJECT_SOURCE_DIR}/src/audio
add_compile_options(-DUNIT_TEST)
add_library(audio_for_selector STATIC
${PROJECT_SOURCE_DIR}/src/math/numbers.c
${PROJECT_SOURCE_DIR}/src/audio/selector/selector.c
${PROJECT_SOURCE_DIR}/src/audio/selector/selector_generic.c
${PROJECT_SOURCE_DIR}/src/audio/buffer.c

View File

@ -30,6 +30,7 @@ add_library(audio_for_volume STATIC
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-stream.c
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-xrun.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
)
sof_append_relative_path_definitions(audio_for_volume)

View File

@ -19,4 +19,5 @@ cmocka_test(fft
${PROJECT_SOURCE_DIR}/src/audio/pipeline/pipeline-xrun.c
${PROJECT_SOURCE_DIR}/test/cmocka/src/common_mocks.c
${PROJECT_SOURCE_DIR}/src/audio/component.c
${PROJECT_SOURCE_DIR}/src/math/numbers.c
)