Only reset the stream id at the end, not the beginning.

This commit is contained in:
Jonathan Naylor
2018-01-12 07:06:38 +00:00
parent a3155c1def
commit 22ed285857
2 changed files with 12 additions and 17 deletions

View File

@@ -80,9 +80,6 @@ m_beacon(false)
m_streamId = new uint32_t[2U]; m_streamId = new uint32_t[2U];
m_jitterBuffers = new CJitterBuffer*[3U]; m_jitterBuffers = new CJitterBuffer*[3U];
m_streamId[0U] = 0x00U;
m_streamId[1U] = 0x00U;
m_jitterBuffers[1U] = new CJitterBuffer("DMR Slot 1", 60U, DMR_SLOT_TIME, jitter, 256U, debug); m_jitterBuffers[1U] = new CJitterBuffer("DMR Slot 1", 60U, DMR_SLOT_TIME, jitter, 256U, debug);
m_jitterBuffers[2U] = new CJitterBuffer("DMR Slot 2", 60U, DMR_SLOT_TIME, jitter, 256U, debug); m_jitterBuffers[2U] = new CJitterBuffer("DMR Slot 2", 60U, DMR_SLOT_TIME, jitter, 256U, debug);
@@ -93,6 +90,9 @@ m_beacon(false)
CStopWatch stopWatch; CStopWatch stopWatch;
::srand(stopWatch.start()); ::srand(stopWatch.start());
m_streamId[0U] = ::rand() + 1U;
m_streamId[1U] = ::rand() + 1U;
} }
CDMRNetwork::~CDMRNetwork() CDMRNetwork::~CDMRNetwork()
@@ -241,15 +241,8 @@ bool CDMRNetwork::write(const CDMRData& data)
} else if (dataType == DT_VOICE) { } else if (dataType == DT_VOICE) {
buffer[15U] |= data.getN(); buffer[15U] |= data.getN();
} else { } else {
if (dataType == DT_VOICE_LC_HEADER) { if (dataType == DT_VOICE_LC_HEADER)
m_streamId[slotIndex] = ::rand() + 1U;
count = 2U; count = 2U;
}
if (dataType == DT_CSBK || dataType == DT_DATA_HEADER) {
m_streamId[slotIndex] = ::rand() + 1U;
count = 1U;
}
buffer[15U] |= (0x20U | dataType); buffer[15U] |= (0x20U | dataType);
} }
@@ -479,7 +472,13 @@ void CDMRNetwork::reset(unsigned int slotNo)
{ {
assert(slotNo == 1U || slotNo == 2U); assert(slotNo == 1U || slotNo == 2U);
m_jitterBuffers[slotNo]->reset(); if (slotNo == 1U) {
m_jitterBuffers[1U]->reset();
m_streamId[0U] = ::rand() + 1U;
} else {
m_jitterBuffers[2U]->reset();
m_streamId[1U] = ::rand() + 1U;
}
} }
void CDMRNetwork::receiveData(const unsigned char* data, unsigned int length) void CDMRNetwork::receiveData(const unsigned char* data, unsigned int length)

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 Jonathan Naylor, G4KLX * Copyright (C) 2015,2016,2017,2018 Jonathan Naylor, G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -361,8 +361,6 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
m_rfFrames = dataHeader.getBlocks(); m_rfFrames = dataHeader.getBlocks();
// m_rfSeqNo = 0U;
m_rfLC = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId); m_rfLC = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
// Regenerate the data header // Regenerate the data header
@@ -436,8 +434,6 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
// Convert the Data Sync to be from the BS or MS as needed // Convert the Data Sync to be from the BS or MS as needed
CSync::addDMRDataSync(data + 2U, m_duplex); CSync::addDMRDataSync(data + 2U, m_duplex);
// m_rfSeqNo = 0U;
data[0U] = TAG_DATA; data[0U] = TAG_DATA;
data[1U] = 0x00U; data[1U] = 0x00U;