Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <sanek23994@gmail.com>

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

0 comments on commit 01a5e83

Please sign in to comment.