Commit f7fe93d1 authored by Adrien Béraud's avatar Adrien Béraud Committed by Gerrit Code Review

pulseaudio: fix memory corruption

Refs #71680

Change-Id: Ibe64bc2fa323c589c2323d2bea4a80269a2a84e0
parent 4e8c7f32
......@@ -468,7 +468,7 @@ void PulseLayer::writeToSpeaker()
pa_stream *s = playback_->pulseStream();
const pa_sample_spec* sample_spec = pa_stream_get_sample_spec(s);
size_t sample_size = pa_frame_size(sample_spec);
const AudioFormat format(playback_->getFormat());
const AudioFormat format(sample_spec->rate, sample_spec->channels);
// available bytes to be written in pulseaudio internal buffer
int ret = pa_stream_writable_size(s);
......@@ -554,9 +554,10 @@ void PulseLayer::writeToSpeaker()
pa_stream_begin_write(s, (void**)&data, &resampledBytes);
Manager::instance().getRingBufferPool().getData(playbackBuffer_, RingBufferPool::DEFAULT_ID);
playbackBuffer_.setChannelNum(format.nb_channels, true);
if (resample) {
AudioBuffer rsmpl_out(nResampled, format);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment