chore: Add debug logging to CodecStream

pull/23/head
Dave Behnke 1 month ago
parent 26ff637e81
commit f5037d36dc

@ -1,5 +1,5 @@
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved. // Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
//
// urfd -- The universal reflector // urfd -- The universal reflector
// Copyright © 2021 Thomas A. Early N7TAE // Copyright © 2021 Thomas A. Early N7TAE
// //
@ -88,6 +88,7 @@ void CCodecStream::ResetStats(uint16_t streamid, ECodecType type)
if (g_Configure.GetBoolean(g_Keys.audio.enable)) if (g_Configure.GetBoolean(g_Keys.audio.enable))
{ {
std::string path = g_Configure.GetString(g_Keys.audio.path); std::string path = g_Configure.GetString(g_Keys.audio.path);
std::cout << "DEBUG: ResetStats starting recording to path: " << path << std::endl;
m_Filename = m_Recorder.Start(path); m_Filename = m_Recorder.Start(path);
} }
else else
@ -137,9 +138,6 @@ bool CCodecStream::InitCodecStream()
return false; return false;
} }
////////////////////////////////////////////////////////////////////////////////////////
// thread
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// threads // threads
@ -158,15 +156,10 @@ void CCodecStream::RxThread()
if (g_TCServer.Receive(m_CSModule, &pack, 1000)) // 1s timeout to check keep_running occasionally if (g_TCServer.Receive(m_CSModule, &pack, 1000)) // 1s timeout to check keep_running occasionally
{ {
// LOGGING DEBUG
std::cout << "DEBUG: RxThread Received packet. Module=" << m_CSModule << " IsOpen=" << m_IsOpen << std::endl;
if ( m_LocalQueue.IsEmpty() ) if ( m_LocalQueue.IsEmpty() )
// ...
}
else
{
// Receive timed out or failed (e.g. module not open).
// Sleep briefly to prevent busy-looping if Receive returns immediately (error case).
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
{ {
std::cout << "Unexpected transcoded packet received from transcoder: Module='" << pack.module << "' StreamID=" << std::hex << std::showbase << ntohs(pack.streamid) << std::endl; std::cout << "Unexpected transcoded packet received from transcoder: Module='" << pack.module << "' StreamID=" << std::hex << std::showbase << ntohs(pack.streamid) << std::endl;
} }
@ -174,6 +167,7 @@ void CCodecStream::RxThread()
{ {
// pop the original packet // pop the original packet
auto Packet = m_LocalQueue.Pop(); auto Packet = m_LocalQueue.Pop();
std::cout << "DEBUG: Popped packet from LocalQueue. Matching..." << std::endl;
// make sure this is the correct packet // make sure this is the correct packet
if ((pack.streamid == Packet->GetCodecPacket()->streamid) && (pack.sequence == Packet->GetCodecPacket()->sequence)) if ((pack.streamid == Packet->GetCodecPacket()->streamid) && (pack.sequence == Packet->GetCodecPacket()->sequence))
@ -202,8 +196,13 @@ void CCodecStream::RxThread()
// Write audio to recorder if active // Write audio to recorder if active
if (m_Recorder.IsRecording()) if (m_Recorder.IsRecording())
{ {
// std::cout << "DEBUG: Writing audio frame" << std::endl;
m_Recorder.Write(pack.usrp, 160); m_Recorder.Write(pack.usrp, 160);
} }
else
{
std::cout << "DEBUG: Recorder NOT recording. Filename=" << m_Filename << std::endl;
}
// mark the DStar sync frames if the source isn't dstar // mark the DStar sync frames if the source isn't dstar
if (ECodecType::dstar!=Packet->GetCodecIn() && 0==Packet->GetPacketId()%21) if (ECodecType::dstar!=Packet->GetCodecIn() && 0==Packet->GetPacketId()%21)
@ -231,6 +230,12 @@ void CCodecStream::RxThread()
std::cout << "Transcoder packet received but CodecStream[" << m_CSModule << "] is closed: Module='" << pack.module << "' StreamID=" << std::hex << std::showbase << ntohs(pack.streamid) << std::endl; std::cout << "Transcoder packet received but CodecStream[" << m_CSModule << "] is closed: Module='" << pack.module << "' StreamID=" << std::hex << std::showbase << ntohs(pack.streamid) << std::endl;
} }
} }
else
{
// Receive timed out or failed (e.g. module not open).
// Sleep briefly to prevent busy-looping if Receive returns immediately (error case).
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.