summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-10 17:35:23 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-10 17:35:23 +0100
commit90c973307607be9ed8f943a79a36a28a46c07502 (patch)
tree6f9d9cc7187e3c4f6fb11a95462c341998017049 /src
parente4821033a325b748c1c69848554b349c76ba6f59 (diff)
downloadfdk-aac-dabplus-90c973307607be9ed8f943a79a36a28a46c07502.tar.gz
fdk-aac-dabplus-90c973307607be9ed8f943a79a36a28a46c07502.tar.bz2
fdk-aac-dabplus-90c973307607be9ed8f943a79a36a28a46c07502.zip
Fix VLC queue fill and increase queue size
Diffstat (limited to 'src')
-rw-r--r--src/VLCInput.cpp10
-rw-r--r--src/VLCInput.h4
-rw-r--r--src/dabplus-enc.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp
index 890de01..4ec9208 100644
--- a/src/VLCInput.cpp
+++ b/src/VLCInput.cpp
@@ -368,11 +368,15 @@ void VLCInputThreaded::start()
}
}
+// How many samples we insert into the queue each call
+// 10 samples @ 32kHz = 3.125ms
+#define NUM_BYTES_PER_CALL (10 * BYTES_PER_SAMPLE)
+
void VLCInputThreaded::process()
{
- uint8_t samplebuf[NUM_SAMPLES_PER_CALL * BYTES_PER_SAMPLE * m_channels];
+ uint8_t samplebuf[NUM_BYTES_PER_CALL];
while (m_running) {
- ssize_t n = m_read(samplebuf, NUM_SAMPLES_PER_CALL);
+ ssize_t n = m_read(samplebuf, NUM_BYTES_PER_CALL);
if (n < 0) {
m_running = false;
@@ -380,7 +384,7 @@ void VLCInputThreaded::process()
break;
}
- m_queue.push(samplebuf, BYTES_PER_SAMPLE*m_channels*n);
+ m_queue.push(samplebuf, n);
}
}
diff --git a/src/VLCInput.h b/src/VLCInput.h
index f880642..27d6237 100644
--- a/src/VLCInput.h
+++ b/src/VLCInput.h
@@ -38,9 +38,6 @@
// 16 bits per sample is fine for now
#define BYTES_PER_SAMPLE 2
-// How many samples we insert into the queue each call
-#define NUM_SAMPLES_PER_CALL 10 // 10 samples @ 32kHz = 3.125ms
-
/* Common functionality for the direct libvlc input and the
* threaded libvlc input
*/
@@ -93,6 +90,7 @@ class VLCInput
protected:
void cleanup(void);
+ // Fill exactly length bytes into buf. Blocking.
ssize_t m_read(uint8_t* buf, size_t length);
std::vector<uint8_t> m_current_buf;
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index 2e7f4fa..ff84de3 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -582,7 +582,7 @@ int main(int argc, char *argv[])
uint8_t input_buf[input_size];
- int max_size = 2*input_size + NUM_SAMPLES_PER_CALL;
+ int max_size = 4*input_size + NUM_SAMPLES_PER_CALL;
SampleQueue<uint8_t> queue(BYTES_PER_SAMPLE, channels, max_size);