more checking

main
Tom Early 4 years ago
parent c2c6a5808f
commit 88e91e9d03

@ -387,28 +387,29 @@ void CDV3003::FeedDevice()
if (packet->IsLast()) if (packet->IsLast())
Controller.Dump(packet, "FeedDevice got a packet from inq:"); Controller.Dump(packet, "FeedDevice got a packet from inq:");
#endif #endif
bool device_is_ready = false;
const bool needs_audio = (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 while (keep_running) // wait until there is room
{ {
if (needs_audio) if (needs_audio)
{ {
// we need to decode ambe to audio // we need to decode ambe to audio
if (ch_depth < 2) if (ch_depth < 2)
device_is_ready = true; break;
} }
else else
{ {
// we need to encode audio to ambe // we need to encode audio to ambe
if (sp_depth < 2) if (sp_depth < 2)
device_is_ready = true; break;
} }
if (! device_is_ready) std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(std::chrono::milliseconds(2)); std::cout << "depth: ch=" << ch_depth << " sp=" << sp_depth << std::endl;
std::cout.flush();
} }
if (keep_running && device_is_ready) if (keep_running)
{ {
// save the packet in the vocoder's queue while the vocoder does its magic // save the packet in the vocoder's queue while the vocoder does its magic
vocq[current_vocoder].push(packet); vocq[current_vocoder].push(packet);

Loading…
Cancel
Save

Powered by TurnKey Linux.