More rollback to original jitter buffer processing.
This commit is contained in:
parent
1e7f99127f
commit
d0c3d1ecfb
|
@ -21,7 +21,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter, bool ovcm) :
|
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, bool ovcm) :
|
||||||
m_colorCode(colorCode),
|
m_colorCode(colorCode),
|
||||||
m_modem(modem),
|
m_modem(modem),
|
||||||
m_network(network),
|
m_network(network),
|
||||||
|
@ -38,7 +38,7 @@ m_lookup(lookup)
|
||||||
// Load black and white lists to DMRAccessControl
|
// Load black and white lists to DMRAccessControl
|
||||||
CDMRAccessControl::init(blacklist, whitelist, slot1TGWhitelist, slot2TGWhitelist, selfOnly, prefixes, id);
|
CDMRAccessControl::init(blacklist, whitelist, slot1TGWhitelist, slot2TGWhitelist, selfOnly, prefixes, id);
|
||||||
|
|
||||||
CDMRSlot::init(colorCode, embeddedLCOnly, dumpTAData, callHang, modem, network, display, duplex, m_lookup, rssi, jitter, ovcm);
|
CDMRSlot::init(colorCode, embeddedLCOnly, dumpTAData, callHang, modem, network, display, duplex, m_lookup, rssi, ovcm);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDMRControl::~CDMRControl()
|
CDMRControl::~CDMRControl()
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
class CDMRControl {
|
class CDMRControl {
|
||||||
public:
|
public:
|
||||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter, bool ovcm);
|
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, bool ovcm);
|
||||||
~CDMRControl();
|
~CDMRControl();
|
||||||
|
|
||||||
bool processWakeup(const unsigned char* data);
|
bool processWakeup(const unsigned char* data);
|
||||||
|
|
|
@ -34,6 +34,7 @@ const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||||
|
|
||||||
|
|
||||||
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, HW_TYPE hwType, unsigned int jitter) :
|
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, HW_TYPE hwType, unsigned int jitter) :
|
||||||
|
m_addressStr(address),
|
||||||
m_address(),
|
m_address(),
|
||||||
m_port(port),
|
m_port(port),
|
||||||
m_id(NULL),
|
m_id(NULL),
|
||||||
|
@ -134,6 +135,9 @@ bool CDMRNetwork::open()
|
||||||
{
|
{
|
||||||
LogMessage("DMR, Opening DMR Network");
|
LogMessage("DMR, Opening DMR Network");
|
||||||
|
|
||||||
|
if (m_address.s_addr == INADDR_NONE)
|
||||||
|
m_address = CUDPSocket::lookup(m_addressStr);
|
||||||
|
|
||||||
m_status = WAITING_CONNECT;
|
m_status = WAITING_CONNECT;
|
||||||
m_timeoutTimer.stop();
|
m_timeoutTimer.stop();
|
||||||
m_retryTimer.start();
|
m_retryTimer.start();
|
||||||
|
|
|
@ -60,7 +60,8 @@ public:
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string m_addressStr;
|
||||||
in_addr m_address;
|
in_addr m_address;
|
||||||
unsigned int m_port;
|
unsigned int m_port;
|
||||||
uint8_t* m_id;
|
uint8_t* m_id;
|
||||||
|
|
39
DMRSlot.cpp
39
DMRSlot.cpp
|
@ -47,9 +47,6 @@ bool CDMRSlot::m_ovcm = true;
|
||||||
|
|
||||||
CRSSIInterpolator* CDMRSlot::m_rssiMapper = NULL;
|
CRSSIInterpolator* CDMRSlot::m_rssiMapper = NULL;
|
||||||
|
|
||||||
unsigned int CDMRSlot::m_jitterTime = 360U;
|
|
||||||
unsigned int CDMRSlot::m_jitterSlots = 6U;
|
|
||||||
|
|
||||||
unsigned char* CDMRSlot::m_idle = NULL;
|
unsigned char* CDMRSlot::m_idle = NULL;
|
||||||
|
|
||||||
FLCO CDMRSlot::m_flco1;
|
FLCO CDMRSlot::m_flco1;
|
||||||
|
@ -96,7 +93,6 @@ m_netN(0U),
|
||||||
m_networkWatchdog(1000U, 0U, 1500U),
|
m_networkWatchdog(1000U, 0U, 1500U),
|
||||||
m_rfTimeoutTimer(1000U, timeout),
|
m_rfTimeoutTimer(1000U, timeout),
|
||||||
m_netTimeoutTimer(1000U, timeout),
|
m_netTimeoutTimer(1000U, timeout),
|
||||||
m_packetTimer(1000U, 0U, 50U),
|
|
||||||
m_interval(),
|
m_interval(),
|
||||||
m_elapsed(),
|
m_elapsed(),
|
||||||
m_rfFrames(0U),
|
m_rfFrames(0U),
|
||||||
|
@ -994,7 +990,6 @@ void CDMRSlot::writeEndNet(bool writeEnd)
|
||||||
|
|
||||||
m_networkWatchdog.stop();
|
m_networkWatchdog.stop();
|
||||||
m_netTimeoutTimer.stop();
|
m_netTimeoutTimer.stop();
|
||||||
m_packetTimer.stop();
|
|
||||||
m_netTimeout = false;
|
m_netTimeout = false;
|
||||||
|
|
||||||
m_netFrames = 0U;
|
m_netFrames = 0U;
|
||||||
|
@ -1090,9 +1085,6 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
m_modem->writeDMRAbort(m_slotNo);
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_jitterSlots; i++)
|
|
||||||
writeQueueNet(m_idle);
|
|
||||||
|
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
for (unsigned int i = 0U; i < NO_HEADERS_DUPLEX; i++)
|
for (unsigned int i = 0U; i < NO_HEADERS_DUPLEX; i++)
|
||||||
writeQueueNet(data);
|
writeQueueNet(data);
|
||||||
|
@ -1135,9 +1127,6 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
m_modem->writeDMRAbort(m_slotNo);
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_jitterSlots; i++)
|
|
||||||
writeQueueNet(m_idle);
|
|
||||||
|
|
||||||
// Create a dummy start frame
|
// Create a dummy start frame
|
||||||
unsigned char start[DMR_FRAME_LENGTH_BYTES + 2U];
|
unsigned char start[DMR_FRAME_LENGTH_BYTES + 2U];
|
||||||
|
|
||||||
|
@ -1326,9 +1315,6 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
m_modem->writeDMRAbort(m_slotNo);
|
m_modem->writeDMRAbort(m_slotNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_jitterSlots; i++)
|
|
||||||
writeQueueNet(m_idle);
|
|
||||||
|
|
||||||
// Create a dummy start frame
|
// Create a dummy start frame
|
||||||
unsigned char start[DMR_FRAME_LENGTH_BYTES + 2U];
|
unsigned char start[DMR_FRAME_LENGTH_BYTES + 2U];
|
||||||
|
|
||||||
|
@ -1407,7 +1393,6 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
m_netEmbeddedData[m_netEmbeddedWriteN].reset();
|
m_netEmbeddedData[m_netEmbeddedWriteN].reset();
|
||||||
|
|
||||||
m_packetTimer.start();
|
|
||||||
m_elapsed.start();
|
m_elapsed.start();
|
||||||
|
|
||||||
m_netFrames++;
|
m_netFrames++;
|
||||||
|
@ -1554,7 +1539,6 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
writeQueueNet(data);
|
writeQueueNet(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_packetTimer.start();
|
|
||||||
m_elapsed.start();
|
m_elapsed.start();
|
||||||
|
|
||||||
m_netFrames++;
|
m_netFrames++;
|
||||||
|
@ -1793,21 +1777,6 @@ void CDMRSlot::clock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_netState == RS_NET_AUDIO) {
|
|
||||||
m_packetTimer.clock(ms);
|
|
||||||
|
|
||||||
if (m_packetTimer.isRunning() && m_packetTimer.hasExpired()) {
|
|
||||||
unsigned int elapsed = m_elapsed.elapsed();
|
|
||||||
if (elapsed >= m_jitterTime) {
|
|
||||||
LogDebug("DMR Slot %u, lost audio for %ums filling in", m_slotNo, elapsed);
|
|
||||||
insertSilence(m_jitterSlots);
|
|
||||||
m_elapsed.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_packetTimer.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRSlot::writeQueueRF(const unsigned char *data)
|
void CDMRSlot::writeQueueRF(const unsigned char *data)
|
||||||
|
@ -1881,7 +1850,7 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
|
||||||
m_queue.addData(data, len);
|
m_queue.addData(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter, bool ovcm)
|
void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, bool ovcm)
|
||||||
{
|
{
|
||||||
assert(modem != NULL);
|
assert(modem != NULL);
|
||||||
assert(display != NULL);
|
assert(display != NULL);
|
||||||
|
@ -1901,11 +1870,6 @@ void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData
|
||||||
|
|
||||||
m_rssiMapper = rssiMapper;
|
m_rssiMapper = rssiMapper;
|
||||||
|
|
||||||
m_jitterTime = jitter;
|
|
||||||
|
|
||||||
float jitter_tmp = float(jitter) / 360.0F;
|
|
||||||
m_jitterSlots = (unsigned int) (std::ceil(jitter_tmp) * 6.0F);
|
|
||||||
|
|
||||||
m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U];
|
m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U];
|
||||||
::memcpy(m_idle, DMR_IDLE_DATA, DMR_FRAME_LENGTH_BYTES + 2U);
|
::memcpy(m_idle, DMR_IDLE_DATA, DMR_FRAME_LENGTH_BYTES + 2U);
|
||||||
|
|
||||||
|
@ -2161,7 +2125,6 @@ void CDMRSlot::enable(bool enabled)
|
||||||
|
|
||||||
m_networkWatchdog.stop();
|
m_networkWatchdog.stop();
|
||||||
m_netTimeoutTimer.stop();
|
m_netTimeoutTimer.stop();
|
||||||
m_packetTimer.stop();
|
|
||||||
m_netTimeout = false;
|
m_netTimeout = false;
|
||||||
|
|
||||||
m_netFrames = 0U;
|
m_netFrames = 0U;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
|
|
||||||
void enable(bool enabled);
|
void enable(bool enabled);
|
||||||
|
|
||||||
static void init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter, bool ovcm);
|
static void init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, bool ovcm);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int m_slotNo;
|
unsigned int m_slotNo;
|
||||||
|
@ -89,7 +89,6 @@ private:
|
||||||
CTimer m_networkWatchdog;
|
CTimer m_networkWatchdog;
|
||||||
CTimer m_rfTimeoutTimer;
|
CTimer m_rfTimeoutTimer;
|
||||||
CTimer m_netTimeoutTimer;
|
CTimer m_netTimeoutTimer;
|
||||||
CTimer m_packetTimer;
|
|
||||||
CStopWatch m_interval;
|
CStopWatch m_interval;
|
||||||
CStopWatch m_elapsed;
|
CStopWatch m_elapsed;
|
||||||
unsigned int m_rfFrames;
|
unsigned int m_rfFrames;
|
||||||
|
@ -127,9 +126,6 @@ private:
|
||||||
|
|
||||||
static CRSSIInterpolator* m_rssiMapper;
|
static CRSSIInterpolator* m_rssiMapper;
|
||||||
|
|
||||||
static unsigned int m_jitterTime;
|
|
||||||
static unsigned int m_jitterSlots;
|
|
||||||
|
|
||||||
static unsigned char* m_idle;
|
static unsigned char* m_idle;
|
||||||
|
|
||||||
static FLCO m_flco1;
|
static FLCO m_flco1;
|
||||||
|
|
|
@ -441,7 +441,6 @@ int CMMDVMHost::run()
|
||||||
std::vector<unsigned int> slot2TGWhiteList = m_conf.getDMRSlot2TGWhiteList();
|
std::vector<unsigned int> slot2TGWhiteList = m_conf.getDMRSlot2TGWhiteList();
|
||||||
unsigned int callHang = m_conf.getDMRCallHang();
|
unsigned int callHang = m_conf.getDMRCallHang();
|
||||||
unsigned int txHang = m_conf.getDMRTXHang();
|
unsigned int txHang = m_conf.getDMRTXHang();
|
||||||
unsigned int jitter = m_conf.getDMRNetworkJitter();
|
|
||||||
m_dmrRFModeHang = m_conf.getDMRModeHang();
|
m_dmrRFModeHang = m_conf.getDMRModeHang();
|
||||||
bool dmrBeacons = m_conf.getDMRBeacons();
|
bool dmrBeacons = m_conf.getDMRBeacons();
|
||||||
bool ovcm = m_conf.getDMROVCM();
|
bool ovcm = m_conf.getDMROVCM();
|
||||||
|
@ -492,7 +491,7 @@ int CMMDVMHost::run()
|
||||||
dmrBeaconIntervalTimer.start();
|
dmrBeaconIntervalTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_dmrLookup, rssi, jitter, ovcm);
|
m_dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_dmrLookup, rssi, ovcm);
|
||||||
|
|
||||||
m_dmrTXTimer.setTimeout(txHang);
|
m_dmrTXTimer.setTimeout(txHang);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue