Don't use someone elses infill audio!

This commit is contained in:
Jonathan Naylor 2016-07-21 18:09:29 +01:00
parent f6978d1b80
commit 299f53b551
6 changed files with 37 additions and 12 deletions

View file

@ -82,6 +82,7 @@ m_netBits(1U),
m_rfErrs(0U),
m_netErrs(0U),
m_lastFrame(NULL),
m_lastFrameValid(false),
m_lastEMB(),
m_fp(NULL)
{
@ -667,6 +668,8 @@ void CDMRSlot::writeEndNet(bool writeEnd)
m_display->clearDMR(m_slotNo);
m_lastFrameValid = false;
m_networkWatchdog.stop();
m_netTimeoutTimer.stop();
m_packetTimer.stop();
@ -757,6 +760,8 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
data[0U] = TAG_DATA;
data[1U] = 0x00U;
m_lastFrameValid = false;
m_netTimeoutTimer.start();
m_packetTimer.start();
@ -937,6 +942,8 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
return;
m_lastFrameValid = false;
m_netTimeoutTimer.start();
m_packetTimer.start();
@ -1472,6 +1479,7 @@ bool CDMRSlot::insertSilence(const unsigned char* data, unsigned char seqNo)
if (seq == seqNo) {
// Just copy the data, nothing else to do here
::memcpy(m_lastFrame, data, DMR_FRAME_LENGTH_BYTES + 2U);
m_lastFrameValid = true;
return true;
}
@ -1490,6 +1498,7 @@ bool CDMRSlot::insertSilence(const unsigned char* data, unsigned char seqNo)
insertSilence(count);
::memcpy(m_lastFrame, data, DMR_FRAME_LENGTH_BYTES + 2U);
m_lastFrameValid = true;
return true;
}
@ -1498,11 +1507,16 @@ void CDMRSlot::insertSilence(unsigned int count)
{
unsigned char data[DMR_FRAME_LENGTH_BYTES + 2U];
::memcpy(data, m_lastFrame, 2U); // The control data
::memcpy(data + 2U, m_lastFrame + 24U + 2U, 9U); // Copy the last audio block to the first
::memcpy(data + 24U + 2U, data + 2U, 9U); // Copy the last audio block to the last
::memcpy(data + 9U + 2U, data + 2U, 5U); // Copy the last audio block to the middle (1/2)
::memcpy(data + 19U + 2U, data + 4U + 2U, 5U); // Copy the last audio block to the middle (2/2)
if (m_lastFrameValid) {
::memcpy(data, m_lastFrame, 2U); // The control data
::memcpy(data + 2U, m_lastFrame + 24U + 2U, 9U); // Copy the last audio block to the first
::memcpy(data + 24U + 2U, data + 2U, 9U); // Copy the last audio block to the last
::memcpy(data + 9U + 2U, data + 2U, 5U); // Copy the last audio block to the middle (1/2)
::memcpy(data + 19U + 2U, data + 4U + 2U, 5U); // Copy the last audio block to the middle (2/2)
} else {
// Not sure what to do if this isn't AMBE audio
::memcpy(data, DMR_SILENCE_DATA, DMR_FRAME_LENGTH_BYTES + 2U);
}
unsigned char n = (m_netN + 1U) % 6U;
unsigned char seqNo = m_netSeqNo + 1U;

View file

@ -82,6 +82,7 @@ private:
unsigned int m_rfErrs;
unsigned int m_netErrs;
unsigned char* m_lastFrame;
bool m_lastFrameValid;
CDMREMB m_lastEMB;
FILE* m_fp;
@ -90,12 +91,7 @@ private:
static bool m_selfOnly;
static std::vector<unsigned int> m_prefixes;
static std::vector<unsigned int> m_blackList;
/*
static std::vector<unsigned int> m_dstBlackListSlot1;
static std::vector<unsigned int> m_dstBlackListSlot2;
static std::vector<unsigned int> m_dstWhiteListSlot1;
static std::vector<unsigned int> m_dstWhiteListSlot2;
*/
static CModem* m_modem;
static CDMRIPSC* m_network;
static CDisplay* m_display;

View file

@ -69,6 +69,7 @@ m_netBits(1U),
m_rfErrs(0U),
m_netErrs(0U),
m_lastFrame(NULL),
m_lastFrameValid(false),
m_fp(NULL)
{
assert(display != NULL);
@ -418,6 +419,8 @@ void CDStarControl::writeEndNet()
{
m_netState = RS_NET_IDLE;
m_lastFrameValid = false;
m_display->clearDStar();
m_netTimeoutTimer.stop();
@ -470,6 +473,8 @@ void CDStarControl::writeNetwork()
m_elapsed.start();
m_ackTimer.stop();
m_lastFrameValid = false;
m_netFrames = 0U;
m_netLost = 0U;
@ -808,6 +813,7 @@ bool CDStarControl::insertSilence(const unsigned char* data, unsigned char seqNo
if (oldSeqNo == seqNo) {
// Just copy the data, nothing else to do here
::memcpy(m_lastFrame, data, DSTAR_FRAME_LENGTH_BYTES + 1U);
m_lastFrameValid = true;
return true;
}
@ -823,6 +829,7 @@ bool CDStarControl::insertSilence(const unsigned char* data, unsigned char seqNo
insertSilence(count);
::memcpy(m_lastFrame, data, DSTAR_FRAME_LENGTH_BYTES + 1U);
m_lastFrameValid = true;
return true;
}
@ -832,7 +839,7 @@ void CDStarControl::insertSilence(unsigned int count)
unsigned char n = (m_netN + 1U) % 21U;
for (unsigned int i = 0U; i < count; i++) {
if (i < 3U) {
if (i < 3U && m_lastFrameValid) {
if (n == 0U) {
::memcpy(m_lastFrame + DSTAR_VOICE_FRAME_LENGTH_BYTES + 1U, DSTAR_NULL_SLOW_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES);
writeQueueDataNet(m_lastFrame);

View file

@ -78,6 +78,7 @@ private:
unsigned int m_rfErrs;
unsigned int m_netErrs;
unsigned char* m_lastFrame;
bool m_lastFrameValid;
FILE* m_fp;
void writeNetwork();

View file

@ -48,6 +48,7 @@ m_rfDest(NULL),
m_netSource(NULL),
m_netDest(NULL),
m_lastFrame(NULL),
m_lastFrameValid(false),
m_lastMode(YSF_DT_VOICE_FR_MODE),
m_netN(0U),
m_rfPayload(),
@ -355,6 +356,8 @@ void CYSFControl::writeEndNet()
m_networkWatchdog.stop();
m_packetTimer.stop();
m_lastFrameValid = false;
m_netPayload.reset();
m_display->clearFusion();
@ -401,6 +404,7 @@ void CYSFControl::writeNetwork()
m_netPayload.reset();
m_packetTimer.start();
m_elapsed.start();
m_lastFrameValid = false;
m_netState = RS_NET_AUDIO;
m_netFrames = 0U;
m_netLost = 0U;
@ -671,6 +675,7 @@ bool CYSFControl::insertSilence(const unsigned char* data, unsigned char n)
if (newN == n) {
// Just copy the data, nothing else to do here
::memcpy(m_lastFrame, data, YSF_FRAME_LENGTH_BYTES + 2U);
m_lastFrameValid = true;
return true;
}
@ -690,6 +695,7 @@ bool CYSFControl::insertSilence(const unsigned char* data, unsigned char n)
insertSilence(count);
::memcpy(m_lastFrame, data, YSF_FRAME_LENGTH_BYTES + 2U);
m_lastFrameValid = true;
return true;
}

View file

@ -66,6 +66,7 @@ private:
unsigned char* m_netSource;
unsigned char* m_netDest;
unsigned char* m_lastFrame;
bool m_lastFrameValid;
unsigned char m_lastMode;
unsigned char m_netN;
CYSFPayload m_rfPayload;