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

Skip to content
Commit f43be0c7 authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioFlinger: fix unique ID generation after crash

The uniqued ID generator will generate the same audio session IDs
after a native audioserver restarts as it always resumes genrating from 1.
This can be a problem as the session ID of existing clients is
preserved on client side and reused when the client reconnects after a
native audioserver process crash.
This is particularly likely to happen with system sounds (touch sounds)
for which an audio track is created early in the init phase and stays
around forever.

To mitigate this risk, offset the allocation range by the
elapsed system time (monotonic) to push risk of overlap until after
first wrap around. Accounting for an average of one new ID per second
seems a good compromise between limiting the risk of overlap and leaving
room before the first wrap around.

Bug: 183582878
Test: make
Change-Id: I21b30c144cc3daab425757d7441af9bb62f793e5
parent c1992966
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment