Skip to content

Track and export current state

Evangelos Ribeiro Tzaras requested to merge devrtz/callaudiod:query-state into master

Addresses #11 (closed)

Needed for https://gitlab.gnome.org/GNOME/calls/-/issues/392

There are a few things though that could use some feedback:

  • Bikeshed territory: Naming of properties and public API functions It could very well be argued that instead of f.e. EnabledSpeaker (based on the EnableSpeaker method) the property should rather be called SpeakerEnabled which would lead to call_audio_get_speaker_enabled or potentially even better call_audio_is_speaker_enabled. The same would hold true for for the microphone mute state, but on the other hand I prefer *_get_selected_mode() instead of *_get_mode_selected() went with AudioMode, SpeakerState and MicState as suggested by @agx1
  • I've noticed that cad-pulse.c unmutes the mic when we're setting the audio mode to 0, but it doesn't do the same in the speaker case. Either we leave this behaviour as desired, keep track of speaker state changes in the context of audio mode changes, i.e. only reset the speaker if it was enabled while we were in call mode - this does have one caveat in that Calls will not want to switch audio profiles when doing VoIP calls which leaves us the option
  • For this MR to be actually correct, we would need to query the state from PA when the daemon starts because a crash would leave the state inconsistent. I don't think this should be a huge problem though as long as callaudio doesn't crash, so if this is alright I would leave this for a follow up MR. Additionally: I don't know if this querying would need to be audio backend specific a.k.a pulse vs pipewire. Not really having dug into pipewire I would naively expect there to be some compatibility layers handling PA->pipewire transparently. Handled by having an "unknown" state.
  • More even: We currently would (probably? didn't check the code nor tested it) not notice if any of the state changes outside of callaudiod, say the user mutes the mic in pactl, pavucontrol or similar Handled by having an "unknown" state.
Edited by Evangelos Ribeiro Tzaras

Merge request reports

Loading