aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-10 09:22:11 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-10 09:22:11 +0100
commit9a97a88a93bacd62d8426019de9090d35c00054b (patch)
treed560d4225c7062c64ae2353759f716ec7dddeece
parent36ba2a51fa253e6d7bdb8721edbcfb89f4fe8fbd (diff)
downloaddabmux-9a97a88a93bacd62d8426019de9090d35c00054b.tar.gz
dabmux-9a97a88a93bacd62d8426019de9090d35c00054b.tar.bz2
dabmux-9a97a88a93bacd62d8426019de9090d35c00054b.zip
better handing when ZMQ input buffer is full
-rw-r--r--src/dabInputZmq.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp
index dd25806..5ef6b2e 100644
--- a/src/dabInputZmq.cpp
+++ b/src/dabInputZmq.cpp
@@ -117,10 +117,16 @@ int dabInputZmqOpen(void* args, const char* inputUri)
int dabInputZmqReadFrame(dabInputOperations* ops, void* args, void* buffer, int size)
{
+ int rc;
dabInputZmqData* input = (dabInputZmqData*)args;
// Get new ZMQ messages
- int rc = dabInputZmqReadFromSocket(input, size);
+ if (input->frame_buffer.size() < INPUT_ZMQ_MAX_BUFFER_SIZE) {
+ rc = dabInputZmqReadFromSocket(input, size);
+ }
+ else {
+ rc = 0;
+ }
if (input->prebuffering > 0) {
if (rc > 0)
@@ -174,8 +180,8 @@ int dabInputZmqReadFromSocket(dabInputZmqData* input, int framesize)
if (nBytes == 5*framesize) // five frames per superframe
{
if (input->frame_buffer.size() > INPUT_ZMQ_MAX_BUFFER_SIZE) {
- etiLog.print(TcpLog::WARNING, "inputZMQ %s input buffer, full, dropping frame !\n",
- input->uri.c_str());
+ etiLog.print(TcpLog::WARNING, "inputZMQ %s input buffer full (%d), dropping frame !\n",
+ input->frame_buffer.size(), input->uri.c_str());
nBytes = 0;
// we actually drop 2 frames