From bf1773ebcccfc475bb7802a520dabcf10de3e7e0 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 8 Feb 2018 20:34:18 +0000 Subject: [PATCH] Final jitter buffer rollback cleanups. --- DMRNetwork.cpp | 9 ++++++++- DMRSlot.cpp | 8 +++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/DMRNetwork.cpp b/DMRNetwork.cpp index 7ec6a41..f5ff40a 100644 --- a/DMRNetwork.cpp +++ b/DMRNetwork.cpp @@ -246,8 +246,15 @@ bool CDMRNetwork::write(const CDMRData& data) } else if (dataType == DT_VOICE) { buffer[15U] |= data.getN(); } else { - if (dataType == DT_VOICE_LC_HEADER) + if (dataType == DT_VOICE_LC_HEADER) { + m_streamId[slotIndex] = ::rand() + 1U; count = 2U; + } + + if (dataType == DT_CSBK || dataType == DT_DATA_HEADER) { + m_streamId[slotIndex] = ::rand() + 1U; + count = 1U; + } buffer[15U] |= (0x20U | dataType); } diff --git a/DMRSlot.cpp b/DMRSlot.cpp index f0dbd2c..5b0178b 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -45,7 +45,7 @@ unsigned int CDMRSlot::m_hangCount = 3U * 17U; CRSSIInterpolator* CDMRSlot::m_rssiMapper = NULL; -unsigned int CDMRSlot::m_jitterTime = 300U; +unsigned int CDMRSlot::m_jitterTime = 300U; unsigned int CDMRSlot::m_jitterSlots = 5U; unsigned char* CDMRSlot::m_idle = NULL; @@ -571,8 +571,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) } else { if (m_rfState == RS_RF_AUDIO) { m_rfN = data[1U] & 0x0FU; - - if(m_rfN > 5U) + if (m_rfN > 5U) return false; unsigned int errors = 0U; @@ -814,8 +813,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) writeNetworkRF(start, DT_VOICE_LC_HEADER); m_rfN = data[1U] & 0x0FU; - - if(m_rfN > 5U) + if (m_rfN > 5U) return false; // Regenerate the EMB