Signal PJMEDIA_EVENT_AUD_DEV_ERROR on audio device failures #4754
+240
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Audio device play/record failures were not consistently signaled across implementations. Only WMME and Oboe published
PJMEDIA_EVENT_AUD_DEV_ERRORevents, andpjsua_ext_snd_devdid not subscribe to these events.Changes
Added event publishing to audio device backends:
alsa_dev.c): Publish events in playback/capture thread error pathspa_dev.c): Publish events in recorder/playback callbacks before returningpaAbortopensl_dev.c): Publish events on callback failures and buffer enqueue errorsandroid_jni_dev.c): Publish events in recorder/track callback error pathscoreaudio_dev.m): Publish events in input/output renderer callbacksMade
pjsua_ext_snd_devsubscribe to events:pjsua_ext_snd_dev_create()after sound device connectionpjsua_ext_snd_dev_destroy()before sound port destructionAll implementations follow the existing pattern from WMME/Oboe:
Events are only published on actual errors, not during normal shutdown (
quit_flagcheck).Motivation and Context
Applications using
on_media_event()callback receive audio device errors inconsistently depending on which backend is active. This makes error handling unreliable across platforms.How Has This Been Tested?
./pjsua-x86_64-pc-linux-gnu --null-audio --no-cli-consoleTypes of changes
Checklist:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.