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

Commit d0cc2529 authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Prevent A2DP bit pool calculation endless loops.

This prevents log spam and endless loops in the A2DP bit pool
calculation. Protecting against the endless loop with prevent battery
draining issues and phone unresponsiveness.

This patch addresses the symptom. A separate patch will be submitted
once root cause is determined to address the problem.

Change-Id: I045b724c1c1638551b9333249f39eee109fa9ba1
parent 7eafa083
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1968,10 +1968,15 @@ static void btif_media_task_enc_update(BT_HDR *p_msg)
            else if (s16BitPool < pUpdateAudio->MinBitPool)
            {
                APPL_TRACE_WARNING("btif_media_task_enc_update computed bitpool too small (%d)", s16BitPool);

                /* Increase bitrate */
                UINT16 previous_u16BitRate = btif_media_cb.encoder.u16BitRate;
                btif_media_cb.encoder.u16BitRate += BTIF_MEDIA_BITRATE_STEP;
                /* Record that we have increased the bitrate */
                protect |= 2;
                /* Check over-flow */
                if (btif_media_cb.encoder.u16BitRate < previous_u16BitRate)
                    protect |= 3;
            }
            else
            {