aboutsummaryrefslogtreecommitdiffstats
path: root/src/VLCInput.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-05 16:26:23 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-05 16:26:23 +0100
commit3330e5d76e1c224cb5c7b43e517bf869d1454d6d (patch)
treed2a025986ff538bee677f18422b266f5466d7e1f /src/VLCInput.cpp
parent25e075244025a930b9f6dda16138eca9d9877643 (diff)
downloadODR-AudioEnc-3330e5d76e1c224cb5c7b43e517bf869d1454d6d.tar.gz
ODR-AudioEnc-3330e5d76e1c224cb5c7b43e517bf869d1454d6d.tar.bz2
ODR-AudioEnc-3330e5d76e1c224cb5c7b43e517bf869d1454d6d.zip
Fix downmixing for VLC
Diffstat (limited to 'src/VLCInput.cpp')
-rw-r--r--src/VLCInput.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp
index 5912509..6519d49 100644
--- a/src/VLCInput.cpp
+++ b/src/VLCInput.cpp
@@ -332,16 +332,13 @@ void VLCInput::postRender_cb(unsigned int channels, size_t size)
assert(size == m_current_buf.size() * sizeof(float));
- if (channels == getChannels()) {
+ if (channels == m_channels) {
size_t queue_size = m_queue.size();
m_queue.resize(m_queue.size() + m_current_buf.size());
std::copy(m_current_buf.begin(), m_current_buf.end(),
m_queue.begin() + queue_size);
}
- else if (channels == 2 and getChannels() == 1) {
- size_t queue_size = m_queue.size();
- m_queue.resize(m_queue.size() + m_current_buf.size());
-
+ else if (channels == 2 and m_channels == 1) {
// Downmix to 1 channel
for (size_t i = 0; i+1 < m_current_buf.size(); i += 2) {
m_queue.push_back(0.5f * (m_current_buf[i] + m_current_buf[i+1]));
@@ -349,7 +346,7 @@ void VLCInput::postRender_cb(unsigned int channels, size_t size)
}
else {
fprintf(stderr, "Got invalid number of channels back from VLC! "
- "requested: %d, got %d\n", getChannels(), channels);
+ "requested: %d, got %d\n", m_channels, channels);
m_running = false;
m_fault = true;
}