mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 22:36:30 +01:00
axfer: Fix creation of v1.2 headers on big-endian systems
struct block_v120_format defines these members as uint8_t. On
little-endian systems, no swapping is done, and the generated block
header is fine. However, on big-endian machines, the value is swapped to
the high byte and then truncated by the assignment, causing both
bits_per_sample and samples_per_frame to be zero.
This fixes an assertion failure in container-test when later
parsing the header ["assert(*samples_per_frame > 0);" in
container_context_pre_process()].
Fixes: 4ab7510f3a
: ("axfer: add support for a container of Creative Tech. voice format")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
551cc37fc6
commit
60f78865d3
1 changed files with 2 additions and 2 deletions
|
@ -622,8 +622,8 @@ static int write_v120_format_block(struct container_context *cntr,
|
|||
build_block_data_size(block->size, 12 + byte_count);
|
||||
|
||||
block->frames_per_second = htole32(frames_per_second);
|
||||
block->bits_per_sample = htole16(state->bytes_per_sample * 8);
|
||||
block->samples_per_frame = htole16(state->samples_per_frame);
|
||||
block->bits_per_sample = state->bytes_per_sample * 8;
|
||||
block->samples_per_frame = state->samples_per_frame;
|
||||
block->code_id = htole16(state->code_id);
|
||||
|
||||
return container_recursive_write(cntr, block, sizeof(*block));
|
||||
|
|
Loading…
Reference in a new issue