Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b79cccf authored by Alexy Joseph's avatar Alexy Joseph Committed by Gerrit - the friendly Code Review server
Browse files

hal: align fragment size to 24 instead of 1024 for PCM offload

Aligning PCM buffer size to 1024 bytes is not required in case
of PCM offloading. It actually creates problem when playing
6 ch, 96KHz, 16-bit stream PCM in offload mode, due to aligning
PCM data becomes unequal for the six channels.
Align the buffer to LCM of 2, 4, 6, 8 i.e. 24.

Change-Id: I0823ca2ccdd5fceaf23a182b763a1d69f91f602f
parent bd5ad8fc
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2927,9 +2927,8 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info)
                     * info->sample_rate
                     * (bits_per_sample >> 3)
                     * popcount(info->channel_mask))/1000;

    fragment_size = ALIGN (fragment_size, 1024);

    // align with LCM of 2, 4, 6, 8
    fragment_size = ALIGN( fragment_size, 24 );
    if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE)
        fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE;
    else if(fragment_size > MAX_PCM_OFFLOAD_FRAGMENT_SIZE)