Skip to content

(halium11) libaudioclient: Fix infinite loop in get_audio_flinger()#84

Open
berbascum wants to merge 1 commit into
Halium:halium-11.0from
berbascum:fix/h11-audio-flinger-inf-loop
Open

(halium11) libaudioclient: Fix infinite loop in get_audio_flinger()#84
berbascum wants to merge 1 commit into
Halium:halium-11.0from
berbascum:fix/h11-audio-flinger-inf-loop

Conversation

@berbascum
Copy link
Copy Markdown

In Halium environments, AudioFlinger is replaced by CameraRecordService for audio recording.

However, get_audio_flinger() still attempts to contact AudioFlinger
using an infinite blocking loop:

do {
    binder = sm->getService(String16("media.audio_flinger"));
    if (binder != 0)
        break;
    ALOGW("AudioFlinger not published, waiting...");
    usleep(500000);
} while (true);

When AudioFlinger is not started, getService() never succeeds,
and the function remains trapped in the infinite while(true=) loop,
blocking the audio thread indefinitely.

Impact:
Camera video recording with audio in hardware mode might fail
on halium-11 for some devices.

Solution:
Check for CameraRecordService. If running, skip audioflinger wait loop.

The infinite loop happens when recording video+audio in hardware mode
from a qt6 camera application.

The change has been fixed the problem on a Xiaomi vayu running Droidian.

More details in the patch body message.

Signed-off-by: berbascum <berbascum@ticv.cat>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant