From 23f5d4758f3a2e6ae65bae8b6f9fe00b77c84ce4 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 14 May 2014 21:20:56 +0200 Subject: Correct dabInputZMQ messageReceived flag handling --- src/dabInputZmq.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp index 6df08c8..b0a44e7 100644 --- a/src/dabInputZmq.cpp +++ b/src/dabInputZmq.cpp @@ -344,7 +344,7 @@ int DabInputZmqBase::readFrame(void* buffer, int size) // Read a MPEG frame from the socket, and push to list int DabInputZmqMPEG::readFromSocket(size_t framesize) { - bool messageReceived; + bool messageReceived = false; zmq::message_t msg; try { @@ -369,7 +369,7 @@ int DabInputZmqMPEG::readFromSocket(size_t framesize) "inputZMQ " << m_name << " buffer full (" << m_frame_buffer.size() << ")," " dropping incoming frame !"; - messageReceived = 0; + messageReceived = false; } else if (m_enable_input) { // copy the input frame blockwise into the frame_buffer @@ -386,9 +386,10 @@ int DabInputZmqMPEG::readFromSocket(size_t framesize) "inputZMQ " << m_name << " wrong data size: recv'd " << msg.size() << ", need " << framesize << "."; + messageReceived = false; } - return msg.size(); + return messageReceived ? msg.size() : 0; } /******** AAC+ input *******/ @@ -445,7 +446,7 @@ int DabInputZmqAAC::readFromSocket(size_t framesize) "inputZMQ " << m_name << " buffer full (" << m_frame_buffer.size() << ")," " dropping incoming superframe !"; - messageReceived = 0; + datalen = 0; } else if (m_enable_input) { // copy the input frame blockwise into the frame_buffer -- cgit v1.2.3