From eff89354e31262d6d99e0a7d7f9b6d371c26195a Mon Sep 17 00:00:00 2001 From: Tom Early Date: Wed, 22 Dec 2021 08:22:45 -0700 Subject: [PATCH] fixed vocq bug --- DV3003.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/DV3003.cpp b/DV3003.cpp index 2003825..b763948 100644 --- a/DV3003.cpp +++ b/DV3003.cpp @@ -385,11 +385,11 @@ void CDV3003::FeedDevice() if (packet) { bool device_is_ready = false; - bool has_ambe = (Encoding::dstar==type) ? packet->DStarIsSet() : packet->DMRIsSet(); + const bool needs_audio = (Encoding::dstar==type) ? packet->DStarIsSet() : packet->DMRIsSet(); while (keep_running && (! device_is_ready)) // wait until there is room { - if (has_ambe) + if (needs_audio) { // we need to decode ambe to audio if (ch_depth < 2) @@ -407,10 +407,12 @@ void CDV3003::FeedDevice() if (keep_running && device_is_ready) { + // save the packet in the vocoder's queue while the vocoder does its magic voc_mux[current_vocoder].lock(); - vocq->push(packet); + vocq[current_vocoder].push(packet); voc_mux[current_vocoder].unlock(); - if (has_ambe) + + if (needs_audio) { SendAudio(current_vocoder, packet->GetAudio()); sp_depth++; @@ -422,9 +424,6 @@ void CDV3003::FeedDevice() { SendData(current_vocoder, (Encoding::dstar==type) ? packet->GetDStarData() : packet->GetDMRData()); ch_depth++; -#ifdef DEBUG - std::cout << "Sent AMBE to " << devicepath << std::endl; -#endif } if(++current_vocoder > 2) current_vocoder = 0;