From 253ebf9dd8e51edc1aff7eb8110d0b34e27b3382 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Wed, 22 Dec 2021 10:42:52 -0700 Subject: [PATCH] more debug tracing of last packet --- Controller.cpp | 2 +- Controller.h | 2 +- DV3003.cpp | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Controller.cpp b/Controller.cpp index a23b5ce..b585610 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -352,7 +352,7 @@ void CController::AppendM17(const std::shared_ptr packet) con void CController::Dump(const std::shared_ptr p, const std::string &title) const { std::stringstream line; - line << title << ": Mod='" << p->GetModule() << "' SID=" << std::showbase << std::hex << ntohs(p->GetStreamId()) << std::noshowbase; + line << title << " Mod='" << p->GetModule() << "' SID=" << std::showbase << std::hex << ntohs(p->GetStreamId()) << std::noshowbase; ECodecType in = p->GetCodecIn(); if (p->DStarIsSet()) diff --git a/Controller.h b/Controller.h index 6d49de6..be1a21c 100644 --- a/Controller.h +++ b/Controller.h @@ -39,6 +39,7 @@ public: void Stop(); void RouteDstPacket(std::shared_ptr packet); void RouteDmrPacket(std::shared_ptr packet); + void Dump(const std::shared_ptr packet, const std::string &title) const; protected: std::atomic keep_running; @@ -65,6 +66,5 @@ protected: #ifdef DEBUG void AppendWave(const std::shared_ptr packet) const; void AppendM17(const std::shared_ptr packet) const; - void Dump(const std::shared_ptr packet, const std::string &title) const; #endif }; diff --git a/DV3003.cpp b/DV3003.cpp index 010cb3a..c9c24ad 100644 --- a/DV3003.cpp +++ b/DV3003.cpp @@ -417,15 +417,19 @@ void CDV3003::FeedDevice() { SendData(current_vocoder, (Encoding::dstar==type) ? packet->GetDStarData() : packet->GetDMRData()); ch_depth++; + #ifdef DEBUG + if (packet->IsLast()) + Controller.Dump(packet, "Queued for decoding:"); + #endif } else { SendAudio(current_vocoder, packet->GetAudio()); sp_depth++; -#ifdef DEBUG + #ifdef DEBUG if (packet->IsLast()) - std::cout << "Sent audio to " << devicepath << std::endl; -#endif + Controller.Dump(packet, "Queued for encoding:"); + #endif } if(++current_vocoder > 2) current_vocoder = 0; @@ -474,6 +478,11 @@ void CDV3003::ReadDevice() packet->SetDStarData(p.payload.ambe.data); else packet->SetDMRData(p.payload.ambe.data); + + #ifdef DEBUG + if (packet->IsLast()) + Controller.Dump(packet, "Data from device is now set:"); + #endif } else if (PKT_SPEECH == p.header.packet_type) { @@ -481,6 +490,11 @@ void CDV3003::ReadDevice() auto pPCM = packet->GetAudio(); for (unsigned int i=0; i<160; i++) pPCM[i] = ntohs(p.payload.audio.samples[i]); + + #ifdef DEBUG + if (packet->IsLast()) + Controller.Dump(packet, "Audio from device is now set:"); + #endif } else {