From b962b4883ea795ef5139bcff5b3165c9a2eb3c31 Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 21:55:41 +0100 Subject: [PATCH 1/8] fix ambed to allow it to be used by multiple xlxd the static Ip var was being shared by all instances of cstream class, then using same ambed by multiple xlxd's (on different ip's) would be a problem, we can just use m_Ip (that already stores the ip of the client reflector, set by controller class when creating cstream) to send packets back --- ambed/cstream.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ambed/cstream.cpp b/ambed/cstream.cpp index 6a4a94b..2986c85 100644 --- a/ambed/cstream.cpp +++ b/ambed/cstream.cpp @@ -174,7 +174,7 @@ void CStream::Thread(CStream *This) void CStream::Task(void) { CBuffer Buffer; - static CIp Ip; + CIp Ip; uint8 uiPid; uint8 Ambe[AMBE_FRAME_SIZE]; CAmbePacket *packet; @@ -207,7 +207,7 @@ void CStream::Task(void) queue->pop(); // send it to client EncodeDvFramePacket(&Buffer, packet->GetPid(), packet->GetAmbe()); - m_Socket.Send(Buffer, Ip, m_uiPort); + m_Socket.Send(Buffer, m_Ip, m_uiPort); // and done delete packet; } From 4f88437ee8a5f7a15ca23f9907f03477c81ae6fb Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 22:00:27 +0100 Subject: [PATCH 2/8] fix error msg showing client ip instead of local --- ambed/cstream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ambed/cstream.cpp b/ambed/cstream.cpp index 2986c85..b9bfd16 100644 --- a/ambed/cstream.cpp +++ b/ambed/cstream.cpp @@ -126,7 +126,7 @@ bool CStream::Init(uint16 uiPort) } else { - std::cout << "Error opening socket on port UDP" << uiPort << " on ip " << m_Ip << std::endl; + std::cout << "Error opening socket on port UDP" << uiPort << " on ip " << g_AmbeServer.GetListenIp() << std::endl; } // done From 60f167b339fba342ab93f358d52e144302194fb6 Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 22:05:28 +0100 Subject: [PATCH 3/8] log IP of the client reflector opening stream --- ambed/ccontroller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ambed/ccontroller.cpp b/ambed/ccontroller.cpp index d6039e8..597d18c 100644 --- a/ambed/ccontroller.cpp +++ b/ambed/ccontroller.cpp @@ -134,7 +134,7 @@ void CController::Task(void) // crack packet if ( IsValidOpenstreamPacket(Buffer, &Callsign, &CodecIn, &CodecOut) ) { - std::cout << "Stream Open from " << Callsign << std::endl; + std::cout << "Stream Open from " << Callsign << " at " << Ip << std::endl; // try create the stream Stream = OpenStream(Callsign, Ip, CodecIn, CodecOut); From 3801ffdec5030a0fed95c516d8b04191632b0034 Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 22:13:07 +0100 Subject: [PATCH 4/8] cleanly print out ambe model and version instead of raw printing whole ambe control packet reply, including non-printable chars, field identifiers and even parity byte... --- ambed/cusb3xxxinterface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ambed/cusb3xxxinterface.cpp b/ambed/cusb3xxxinterface.cpp index c15801c..1ebe3f1 100644 --- a/ambed/cusb3xxxinterface.cpp +++ b/ambed/cusb3xxxinterface.cpp @@ -355,7 +355,12 @@ bool CUsb3xxxInterface::ReadDeviceVersion(void) ok = (len != 0); //we succeed in reading a packet, print it out std::cout << "ReadDeviceVersion : "; - for ( i = 4; i < len+4 ; i++ ) + for ( i = 5; (i < len+4) && (rxpacket[i] != 0x00); i++ ) + { + std::cout << (char)(rxpacket[i] & 0x00ff); + } + std::cout << " "; + for ( i = i+2; (i < len+4) && (rxpacket[i] != 0x00); i++ ) { std::cout << (char)(rxpacket[i] & 0x00ff); } From 0b0cbec470a283431d9be9ccd3b664b743326729 Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 22:51:23 +0100 Subject: [PATCH 5/8] add device serial to vocodec open/close log msgs this allows to identify what device is being used exactly, printing just the device name can't identify it if we have multiple similar devices... --- ambed/cvocodecchannel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ambed/cvocodecchannel.cpp b/ambed/cvocodecchannel.cpp index 7a10d41..29a6fbd 100644 --- a/ambed/cvocodecchannel.cpp +++ b/ambed/cvocodecchannel.cpp @@ -62,8 +62,8 @@ bool CVocodecChannel::Open(void) ok = true; PurgeAllQueues(); std::cout << "Vocodec channel " << - m_InterfaceIn->GetName() << ":" << (int)m_iChannelIn << " -> " << - m_InterfaceOut->GetName() << ":" << (int)m_iChannelOut << " open" << std::endl; + m_InterfaceIn->GetName() << ":" << m_InterfaceIn->GetSerial() << ":" << (int)m_iChannelIn << " -> " << + m_InterfaceOut->GetName() << ":" << m_InterfaceOut->GetSerial() << ":" << (int)m_iChannelOut << " open" << std::endl; } return ok; } @@ -75,8 +75,8 @@ void CVocodecChannel::Close(void) m_bOpen = false; PurgeAllQueues(); std::cout << "Vocodec channel " << - m_InterfaceIn->GetName() << ":" << (int)m_iChannelIn << " -> " << - m_InterfaceOut->GetName() << ":" << (int)m_iChannelOut << " closed" << std::endl; + m_InterfaceIn->GetName() << ":" << m_InterfaceIn->GetSerial() << ":" << (int)m_iChannelIn << " -> " << + m_InterfaceOut->GetName() << ":" << m_InterfaceOut->GetSerial() << ":" << (int)m_iChannelOut << " closed" << std::endl; } } From 247471c15b36a7829ad028b8971f26101e28d993 Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 22:55:55 +0100 Subject: [PATCH 6/8] Update cvocodecinterface.h --- ambed/cvocodecinterface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ambed/cvocodecinterface.h b/ambed/cvocodecinterface.h index 66f8fbb..18484d3 100644 --- a/ambed/cvocodecinterface.h +++ b/ambed/cvocodecinterface.h @@ -46,6 +46,7 @@ public: // get virtual const char *GetName(void) const { return ""; } + virtual const char *GetSerial(void) const { return ""; } // manage channels virtual int GetNbChannels(void) const { return 0; } From aca0e5fba3f771dbfacdb4ae34378f1177b986ea Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 2 Apr 2022 23:01:45 +0100 Subject: [PATCH 7/8] add extra blank line after ftdi devices list --- ambed/cvocodecs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ambed/cvocodecs.cpp b/ambed/cvocodecs.cpp index c89e416..c9e4643 100644 --- a/ambed/cvocodecs.cpp +++ b/ambed/cvocodecs.cpp @@ -289,6 +289,7 @@ bool CVocodecs::DiscoverFtdiDevices(void) list[i].Description, list[i].SerialNumber); m_FtdiDeviceDescrs.push_back(descr); } + std::cout << std::endl; } else { From f9a46808a3593b04784f11cb2e069fcfb4039a49 Mon Sep 17 00:00:00 2001 From: narspt Date: Sat, 23 Jul 2022 22:56:17 +0100 Subject: [PATCH 8/8] remove unused constants on ambed main.h these are only used on xlxd and ambedtest, not at ambed... they may just confuse users trying to tweak something that does nothing. --- ambed/main.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/ambed/main.h b/ambed/main.h index 364bb93..118dcfb 100644 --- a/ambed/main.h +++ b/ambed/main.h @@ -59,8 +59,6 @@ // Transcoder server -------------------------------------------- #define TRANSCODER_PORT 10100 // UDP port -#define TRANSCODER_KEEPALIVE_PERIOD 5 // in seconds -#define TRANSCODER_KEEPALIVE_TIMEOUT 30 // in seconds // Codecs ------------------------------------------------------- #define CODEC_NONE 0