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

Commit 55b3288d authored by Alexy Joseph's avatar Alexy Joseph Committed by Bruno Martins
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
CRs-fixed: 780001
parent c738360c
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -2265,9 +2265,8 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info)
                     * info->sample_rate
                     * info->sample_rate
                     * (bits_per_sample >> 3)
                     * (bits_per_sample >> 3)
                     * popcount(info->channel_mask))/1000;
                     * popcount(info->channel_mask))/1000;

    // align with LCM of 2, 4, 6, 8
    fragment_size = ALIGN (fragment_size, 1024);
    fragment_size = ALIGN( fragment_size, 24 );

    if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE)
    if(fragment_size < MIN_PCM_OFFLOAD_FRAGMENT_SIZE)
        fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE;
        fragment_size = MIN_PCM_OFFLOAD_FRAGMENT_SIZE;
    else if(fragment_size > MAX_PCM_OFFLOAD_FRAGMENT_SIZE)
    else if(fragment_size > MAX_PCM_OFFLOAD_FRAGMENT_SIZE)