m17 data debugging

main
Tom Early 4 years ago
parent 491be2aa4e
commit 0bceb0e303

@ -217,6 +217,12 @@ void CController::AudiotoCodec2(std::shared_ptr<CTranscoderPacket> packet)
{
SendToReflector(packet);
}
#ifdef DEBUG
if (packet->IsSecond())
{
AppendM17(packet);
}
#endif
}
// The original incoming coded was M17, so we will calculate the audio and then
@ -272,19 +278,10 @@ void CController::ProcessC2Thread()
while (keep_running)
{
c2_mux.lock();
auto c2_queue_is_empty = codec2_queue.empty(); // is there a packet avaiable
auto packet = codec2_queue.pop();
c2_mux.unlock();
if (c2_queue_is_empty)
if (packet)
{
// no packet available, sleep for a little while
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
else
{
// a packet is available, so get it
c2_mux.lock();
auto packet = codec2_queue.pop();
c2_mux.unlock();
switch (packet->GetCodecIn())
{
case ECodecType::c2_1600:
@ -300,6 +297,8 @@ void CController::ProcessC2Thread()
break;
}
}
else
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
}
@ -420,10 +419,10 @@ void CController::ReadAmbesThread()
// Finally if the packet is complete, it can be sent back to the reflector.
void CController::ReadDevice(std::shared_ptr<CDV3003> device, EAmbeType type)
{
//save the dmr/dstar type
// save the dmr/dstar type
const char *device_type = (EAmbeType::dstar==type) ? "D-Star" : "DMR";
//read the response from the vocoder
// read the response from the vocoder
SDV3003_Packet devpacket;
if (device->GetResponse(devpacket))
{
@ -537,6 +536,21 @@ void CController::AppendWave(const std::shared_ptr<CTranscoderPacket> packet) co
std::cerr << "could not open pcm file " << sstr.str();
}
void CController::AppendM17(const std::shared_ptr<CTranscoderPacket> packet) const
{
std::stringstream sstr;
sstr << std::hex << ntohs(packet->GetStreamId()) << ".m17";
std::ofstream m17file(sstr.str(), std::ofstream::app | std::ofstream::binary);
if (m17file.good())
{
m17file.write(reinterpret_cast<const char *>(packet->GetM17Data()), 16);
m17file.close();
}
else
std::cerr << "could not open M17 data file " << sstr.str();
}
void CController::Dump(const std::shared_ptr<CTranscoderPacket> p, const std::string &title) const
{
std::string codec;

@ -68,6 +68,7 @@ protected:
void AddFDSet(int &max, int newfd, fd_set *set) const;
#ifdef DEBUG
void AppendWave(const std::shared_ptr<CTranscoderPacket> packet) const;
void AppendM17(const std::shared_ptr<CTranscoderPacket> packet) const;
void Dump(const std::shared_ptr<CTranscoderPacket> packet, const std::string &title) const;
#endif
};

@ -287,7 +287,7 @@ bool CDV3003::ConfigureVocoder(uint8_t pkt_ch, Encoding type)
return true;
};
#ifdef DEBUG
std::cout << devicepath << " channel " << (unsigned int)pkt_ch << " is now configured for " << ((Encoding::dstar == type) ? "D-Star" : "DMR") << std::endl;
std::cout << devicepath << " channel " << (unsigned int)(pkt_ch - PKT_CHANNEL0) << " is now configured for " << ((Encoding::dstar == type) ? "D-Star" : "DMR") << std::endl;
#endif
return false;
}

@ -25,7 +25,7 @@ int main()
if (controller.Start())
return EXIT_FAILURE;
std::cout << "Hybrid Transcoder Version #211219 Successfully started" << std::endl;
std::cout << "Hybrid Transcoder Version #211220 Successfully started" << std::endl;
pause();

Loading…
Cancel
Save

Powered by TurnKey Linux.