diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-05-14 21:20:56 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-05-14 21:20:56 +0200 |
commit | 23f5d4758f3a2e6ae65bae8b6f9fe00b77c84ce4 (patch) | |
tree | e99d045c621af635bef91dfd9ef0a9ac4b020700 | |
parent | e4e2e55cb65f64198216df19e66f8efc13d0df08 (diff) | |
download | dabmux-23f5d4758f3a2e6ae65bae8b6f9fe00b77c84ce4.tar.gz dabmux-23f5d4758f3a2e6ae65bae8b6f9fe00b77c84ce4.tar.bz2 dabmux-23f5d4758f3a2e6ae65bae8b6f9fe00b77c84ce4.zip |
Correct dabInputZMQ messageReceived flag handling
-rw-r--r-- | src/dabInputZmq.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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 |