Skip to content

Commit

Permalink
FIX(client): Correctly subscribe to both sink and source events in Pu…
Browse files Browse the repository at this point in the history
…lseAudioSystem

The second call to pa_context_subscribe() was overriding the first, as a result we were only receiving sink events.

This caused hotplugging to fail with devices that don't have any output ports (e.g. USB microphones).
  • Loading branch information
davidebeatrici committed Mar 31, 2024
1 parent 23f7650 commit f29e7d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mumble/PulseAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,14 +879,14 @@ void PulseAudioSystem::setVolumes() {
void PulseAudioSystem::contextCallback(pa_context *c) {
Q_ASSERT(c == pacContext);
switch (m_pulseAudio.context_get_state(c)) {
case PA_CONTEXT_READY:
case PA_CONTEXT_READY: {
bPulseIsGood = true;
m_pulseAudio.operation_unref(
m_pulseAudio.context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SOURCE, nullptr, this));
m_pulseAudio.operation_unref(
m_pulseAudio.context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SINK, nullptr, this));
const auto mask =
static_cast< pa_subscription_mask_t >(PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE);
m_pulseAudio.operation_unref(m_pulseAudio.context_subscribe(pacContext, mask, nullptr, this));
query();
break;
}
case PA_CONTEXT_TERMINATED:
qWarning("PulseAudio: Forcibly disconnected from PulseAudio");
break;
Expand Down

0 comments on commit f29e7d3

Please sign in to comment.