Skip to content
Browse files

PulseAudio: fix access to protected enums in AudioInput and AudioOutput.

The SampleFormat enums in AudioOutput and AudioInput are meant to be
used in subclasses of AudioOuptut and AudioInput, and because of that,
they're marked protected.

PulseAudioSystem has used these protected enums for some time, without
triggering any warnings. However, recent versions of Clang error out
on this behavior (and rightly so).

To fix this issue, this change modifies PulseAudioSystem to access the
SampleFormat enums via PulseAudioOutput and PulseAudioInput, instead
of going through AudioOutput and AudioInput directly. PulseAudioSystem
is already a friend class of PulseAudioOutput and PulseAudioInput, so
it can access the protected members of AudioOutput of AudioInput just
fine, as long as it happens via PulseAudioOutput and PulseAudioInput.

Originally reported on the Debian BTS (as #753273) by
Alexander <>

Reported on the Mumble issue tracker (as #1302) by
Chris Knadle <>
  • Loading branch information...
mkrautz committed Jul 2, 2014
1 parent 77314f4 commit 01a5e83b76d049ef6ac44c8ce8c4f2cbd5f80e9e
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/mumble/PulseAudio.cpp
@@ -474,9 +474,9 @@ void PulseAudioSystem::read_callback(pa_stream *s, size_t bytes, void *userdata)
pai->iMicFreq = pss->rate;
pai->iMicChannels = pss->channels;
if (pss->format == PA_SAMPLE_FLOAT32NE)
pai->eMicFormat = AudioInput::SampleFloat;
pai->eMicFormat = PulseAudioInput::SampleFloat;
pai->eMicFormat = AudioInput::SampleShort;
pai->eMicFormat = PulseAudioInput::SampleShort;
pai->addMic(data, length / pai->iMicSampleSize);
@@ -486,9 +486,9 @@ void PulseAudioSystem::read_callback(pa_stream *s, size_t bytes, void *userdata)
pai->iEchoFreq = pss->rate;
pai->iEchoChannels = pss->channels;
if (pss->format == PA_SAMPLE_FLOAT32NE)
pai->eEchoFormat = AudioInput::SampleFloat;
pai->eEchoFormat = PulseAudioInput::SampleFloat;
pai->eEchoFormat = AudioInput::SampleShort;
pai->eEchoFormat = PulseAudioInput::SampleShort;
pai->addEcho(data, length / pai->iEchoSampleSize);
@@ -520,9 +520,9 @@ void PulseAudioSystem::write_callback(pa_stream *s, size_t bytes, void *userdata
pao->pss = *pss;
pao->pcm = *pcm;
if (pss->format == PA_SAMPLE_FLOAT32NE)
pao->eSampleFormat = AudioOutput::SampleFloat;
pao->eSampleFormat = PulseAudioOutput::SampleFloat;
pao->eSampleFormat = AudioOutput::SampleShort;
pao->eSampleFormat = PulseAudioOutput::SampleShort;
pao->iMixerFreq = pss->rate;
pao->iChannels = pss->channels;
unsigned int chanmasks[pss->channels];

0 comments on commit 01a5e83

Please sign in to comment.
You can’t perform that action at this time.