aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-03-23 14:09:45 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-03-23 14:09:45 +0100
commit77a15b38809df6084718afdc6116d036715a8b7e (patch)
treef46c41df2c53c77a58cde6bae22e81ea54d80ab9
parent202f869e1a2ec0da5940c25e5ff24d5c34002421 (diff)
downloadODR-AudioEnc-77a15b38809df6084718afdc6116d036715a8b7e.tar.gz
ODR-AudioEnc-77a15b38809df6084718afdc6116d036715a8b7e.tar.bz2
ODR-AudioEnc-77a15b38809df6084718afdc6116d036715a8b7e.zip
Do not copy libVLC data if size absurd
-rw-r--r--src/VLCInput.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp
index 54f71d2..4141535 100644
--- a/src/VLCInput.cpp
+++ b/src/VLCInput.cpp
@@ -166,17 +166,18 @@ void VLCInput::postRender_cb(uint8_t* p_pcm_buffer, size_t size)
{
boost::mutex::scoped_lock lock(m_queue_mutex);
- if (m_current_buf.size() != size) {
+ if (m_current_buf.size() == size) {
+ size_t queue_size = m_queue.size();
+ m_queue.resize(m_queue.size() + size);
+ std::copy(m_current_buf.begin(), m_current_buf.end(),
+ m_queue.begin() + queue_size);
+ }
+ else {
fprintf(stderr,
"Received buffer size is not equal allocated "
"buffer size: %zu vs %zu\n",
m_current_buf.size(), size);
}
-
- size_t queue_size = m_queue.size();
- m_queue.resize(m_queue.size() + size);
- std::copy(m_current_buf.begin(), m_current_buf.end(),
- m_queue.begin() + queue_size);
}
ssize_t VLCInput::m_read(uint8_t* buf, size_t length)