Commit f58b386f authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #28691: pulseaudio: fix resampling of captured mic input

parent 99c14e26
......@@ -509,8 +509,8 @@ void PulseLayer::readFromMic()
const char *data = NULL;
size_t bytes;
size_t sample_size = record_->sampleSize();
uint8_t channels = record_->channels();
const size_t sample_size = record_->sampleSize();
const uint8_t channels = record_->channels();
if (pa_stream_peek(record_->pulseStream() , (const void**) &data , &bytes) < 0 or !data)
return;
......@@ -519,7 +519,9 @@ void PulseLayer::readFromMic()
outfile.write((const char *)data, bytes);
#endif
size_t samples = bytes / sample_size;
assert(channels);
assert(sample_size);
const size_t samples = bytes / sample_size / channels;
AudioBuffer in(samples, channels, sampleRate_);
in.deinterleave((SFLAudioSample*)data, samples, channels);
......
Supports Markdown
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