diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-02-05 16:26:23 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-02-05 16:26:23 +0100 |
commit | 3330e5d76e1c224cb5c7b43e517bf869d1454d6d (patch) | |
tree | d2a025986ff538bee677f18422b266f5466d7e1f | |
parent | 25e075244025a930b9f6dda16138eca9d9877643 (diff) | |
download | ODR-AudioEnc-3330e5d76e1c224cb5c7b43e517bf869d1454d6d.tar.gz ODR-AudioEnc-3330e5d76e1c224cb5c7b43e517bf869d1454d6d.tar.bz2 ODR-AudioEnc-3330e5d76e1c224cb5c7b43e517bf869d1454d6d.zip |
Fix downmixing for VLC
-rw-r--r-- | src/VLCInput.cpp | 9 | ||||
-rw-r--r-- | src/VLCInput.h | 1 |
2 files changed, 3 insertions, 7 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; } diff --git a/src/VLCInput.h b/src/VLCInput.h index c727fdf..99ce01d 100644 --- a/src/VLCInput.h +++ b/src/VLCInput.h @@ -134,7 +134,6 @@ class VLCInput : public InputInterface int getRate() { return m_rate; } - int getChannels() { return m_channels; } virtual bool fault_detected(void) const override { return m_fault; }; |