diff options
Diffstat (limited to 'firmware/pcm.c')
-rw-r--r-- | firmware/pcm.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/firmware/pcm.c b/firmware/pcm.c index b0a91fb64e..f5efb4f84e 100644 --- a/firmware/pcm.c +++ b/firmware/pcm.c | |||
@@ -260,8 +260,7 @@ bool pcm_is_initialized(void) | |||
260 | /* Common code to pcm_play_data and pcm_play_pause */ | 260 | /* Common code to pcm_play_data and pcm_play_pause */ |
261 | static void pcm_play_data_start(unsigned char *start, size_t size) | 261 | static void pcm_play_data_start(unsigned char *start, size_t size) |
262 | { | 262 | { |
263 | start = (unsigned char *)(((uintptr_t)start + 3) & ~3); | 263 | ALIGN_AUDIOBUF(start, size); |
264 | size &= ~3; | ||
265 | 264 | ||
266 | if (!(start && size)) | 265 | if (!(start && size)) |
267 | { | 266 | { |
@@ -271,9 +270,7 @@ static void pcm_play_data_start(unsigned char *start, size_t size) | |||
271 | { | 270 | { |
272 | logf(" get_more"); | 271 | logf(" get_more"); |
273 | get_more(&start, &size); | 272 | get_more(&start, &size); |
274 | 273 | ALIGN_AUDIOBUF(start, size); | |
275 | start = (unsigned char *)(((uintptr_t)start + 3) & ~3); | ||
276 | size &= ~3; | ||
277 | } | 274 | } |
278 | } | 275 | } |
279 | 276 | ||
@@ -319,8 +316,7 @@ void pcm_play_get_more_callback(void **start, size_t *size) | |||
319 | /* Call registered callback */ | 316 | /* Call registered callback */ |
320 | get_more((unsigned char **)start, size); | 317 | get_more((unsigned char **)start, size); |
321 | 318 | ||
322 | *start = (void *)(((uintptr_t)*start + 3) & ~3); | 319 | ALIGN_AUDIOBUF(*start, *size); |
323 | *size &= ~3; | ||
324 | 320 | ||
325 | if (*start && *size) | 321 | if (*start && *size) |
326 | return; | 322 | return; |
@@ -557,9 +553,7 @@ void pcm_record_data(pcm_rec_callback_type more_ready, | |||
557 | { | 553 | { |
558 | logf("pcm_record_data"); | 554 | logf("pcm_record_data"); |
559 | 555 | ||
560 | /* 32-bit aligned and sized data only */ | 556 | ALIGN_AUDIOBUF(start, size); |
561 | start = (void *)(((uintptr_t)start + 3) & ~3); | ||
562 | size &= ~3; | ||
563 | 557 | ||
564 | if (!(start && size)) | 558 | if (!(start && size)) |
565 | { | 559 | { |
@@ -611,8 +605,7 @@ void pcm_rec_more_ready_callback(int status, void **start, size_t *size) | |||
611 | if (have_more && start) | 605 | if (have_more && start) |
612 | { | 606 | { |
613 | have_more(status, start, size); | 607 | have_more(status, start, size); |
614 | *start = (void *)(((uintptr_t)*start + 3) & ~3); | 608 | ALIGN_AUDIOBUF(*start, *size); |
615 | *size &= ~3; | ||
616 | 609 | ||
617 | if (*start && *size) | 610 | if (*start && *size) |
618 | { | 611 | { |