diff --git a/ChangeLog b/ChangeLog index db66459e..cc2cefa4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23722,3 +23722,8 @@ dump when attempting to print an error message. 2022-11-27 Fred Gleason * Incremented the package version to 4.0.0rc0int2. +2022-11-29 Fred Gleason + * Added a 'SuppressRdcatchMeterUpdates=' directive to '[Hacks]' + section of rd.conf(5). + * Fixed a regression in the RDCatch subsystem that caused remote + deck indication to break. diff --git a/conf/rd.conf-sample b/conf/rd.conf-sample index ce96245e..9c698f52 100644 --- a/conf/rd.conf-sample +++ b/conf/rd.conf-sample @@ -203,3 +203,7 @@ TranscodingDelay=0 ; ; Default action is to not save files. ; SaveWebgetFilesDirectory= + +; Suppress meter update messages on the notification multicast channel. +; +;SuppressRdcatchMeterUpdates=No diff --git a/lib/rdconfig.cpp b/lib/rdconfig.cpp index 578c347c..12c076cb 100644 --- a/lib/rdconfig.cpp +++ b/lib/rdconfig.cpp @@ -393,6 +393,12 @@ QString RDConfig::saveWebgetFilesDirectory() const } +bool RDConfig::suppressRdcatchMeterUpdates() const +{ + return conf_suppress_rdcatch_meter_updates; +} + + int RDConfig::meterBasePort() const { return conf_meter_base_port; @@ -615,8 +621,10 @@ bool RDConfig::load() profile->boolValue("Hacks","DisableMaintChecks",false); conf_save_webget_files_directory= profile->stringValue("Hacks","SaveWebgetFilesDirectory"); - conf_lock_rdairplay_memory= - profile->boolValue("Hacks","LockRdairplayMemory",false); + conf_disable_maint_checks= + profile->boolValue("Hacks","DisableMaintChecks",false); + conf_suppress_rdcatch_meter_updates= + profile->boolValue("Hacks","SuppressRdcatchMeterUpdates",false); conf_meter_base_port= profile->intValue("Hacks","MeterPortBaseNumber",RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT); conf_meter_port_range= @@ -745,6 +753,7 @@ void RDConfig::clear() conf_jack_ports[1].clear(); conf_disable_maint_checks=false; conf_save_webget_files_directory=""; + conf_suppress_rdcatch_meter_updates=false; conf_lock_rdairplay_memory=false; conf_meter_base_port=RD_DEFAULT_METER_SOCKET_BASE_UDP_PORT; conf_meter_port_range=RD_METER_SOCKET_PORT_RANGE; diff --git a/lib/rdconfig.h b/lib/rdconfig.h index ceaa774c..d1269d27 100644 --- a/lib/rdconfig.h +++ b/lib/rdconfig.h @@ -104,6 +104,7 @@ class RDConfig int meterBasePort() const; int meterPortRange() const; QString saveWebgetFilesDirectory() const; + bool suppressRdcatchMeterUpdates() const; bool enableMixerLogging() const; uid_t uid() const; gid_t gid() const; @@ -176,6 +177,7 @@ class RDConfig bool conf_disable_maint_checks; bool conf_lock_rdairplay_memory; QString conf_save_webget_files_directory; + bool conf_suppress_rdcatch_meter_updates; int conf_meter_base_port; int conf_meter_port_range; std::vector conf_jack_ports[2]; diff --git a/lib/rdmulticaster.cpp b/lib/rdmulticaster.cpp index e54daeae..69090730 100644 --- a/lib/rdmulticaster.cpp +++ b/lib/rdmulticaster.cpp @@ -2,7 +2,7 @@ // // Multi-interface multicast transciever // -// (C) Copyright 2018-2021 Fred Gleason +// (C) Copyright 2018-2022 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -25,6 +25,8 @@ #include #include +#include + #include "rdmulticaster.h" RDMulticaster::RDMulticaster(QObject *parent) @@ -101,18 +103,10 @@ void RDMulticaster::send(const QString &msg,const QHostAddress &m_addr, void RDMulticaster::readyReadData() { - struct sockaddr_in sa; - socklen_t sa_len=sizeof(struct sockaddr_in); - char data[1501]; - int n; - - memset(&sa,0,sizeof(sa)); - while((n=recvfrom(multi_socket->socketDescriptor(),data,1500,MSG_DONTWAIT, - (sockaddr *)&sa,&sa_len))>0) { - data[n]=0; - QString msg(data); - emit received(msg,QHostAddress(ntohl(sa.sin_addr.s_addr))); - sa_len=sizeof(struct sockaddr_in); + while(multi_socket->hasPendingDatagrams()) { + QNetworkDatagram dg=multi_socket->receiveDatagram(); + printf("emitting: %s",dg.data().constData()); + emit received(QString::fromUtf8(dg.data()),dg.senderAddress()); } } diff --git a/rdcatchd/rdcatchd.cpp b/rdcatchd/rdcatchd.cpp index 0c48f0d1..56ce534b 100644 --- a/rdcatchd/rdcatchd.cpp +++ b/rdcatchd/rdcatchd.cpp @@ -366,7 +366,7 @@ void MainObject::notificationReceivedData(RDNotification *notify) void MainObject::catchEventReceivedData(RDCatchEvent *evt) { // rda->syslog(LOG_NOTICE,"catchEventReceivedData(): %s", - // evt->dump().toUtf8().constData()); + // evt->dump().toUtf8().constData()); RDCatchEvent *resp=NULL; @@ -1030,25 +1030,27 @@ void MainObject::meterData() short levels[2]; QList meter_levels; - for(int i=0;icae()-> - inputMeterUpdate(catch_record_card[i],catch_record_stream[i],levels); - meter_levels.push_back(RDCatchMeterLevel(i+1,levels)); + if(!rda->config()->suppressRdcatchMeterUpdates()) { + for(int i=0;icae()-> + inputMeterUpdate(catch_record_card[i],catch_record_stream[i],levels); + meter_levels.push_back(RDCatchMeterLevel(i+1,levels)); + } + if(catch_playout_deck_status[i]==RDDeck::Recording) { + rda->cae()-> + outputMeterUpdate(catch_playout_card[i],catch_playout_port[i],levels); + meter_levels.push_back(RDCatchMeterLevel(i+129,levels)); + } } - if(catch_playout_deck_status[i]==RDDeck::Recording) { - rda->cae()-> - outputMeterUpdate(catch_playout_card[i],catch_playout_port[i],levels); - meter_levels.push_back(RDCatchMeterLevel(i+129,levels)); + if(meter_levels.size()>0) { + RDCatchEvent *evt=new RDCatchEvent(); + evt->setOperation(RDCatchEvent::SendMeterLevelsOp); + evt->setMeterLevels(meter_levels); + rda->ripc()->sendCatchEvent(evt); + delete evt; } } - if(meter_levels.size()>0) { - RDCatchEvent *evt=new RDCatchEvent(); - evt->setOperation(RDCatchEvent::SendMeterLevelsOp); - evt->setMeterLevels(meter_levels); - rda->ripc()->sendCatchEvent(evt); - delete evt; - } } diff --git a/ripcd/ripcd.cpp b/ripcd/ripcd.cpp index 6c27ecda..7f9c0d15 100644 --- a/ripcd/ripcd.cpp +++ b/ripcd/ripcd.cpp @@ -238,8 +238,8 @@ void MainObject::newConnectionData() void MainObject::notificationReceivedData(const QString &msg, const QHostAddress &addr) { - QStringList f0=msg.split(msg,QString::SkipEmptyParts); - if(msg.at(0)=="NOTIFY") { + QStringList f0=msg.split(" ",QString::SkipEmptyParts); + if(f0.at(0)=="NOTIFY") { RDNotification *notify=new RDNotification(); if(!notify->read(msg)) { rda->syslog(LOG_INFO,"invalid notification received from %s", @@ -251,7 +251,7 @@ void MainObject::notificationReceivedData(const QString &msg, BroadcastCommand("ON "+msg+"!"); delete notify; } - if(msg.at(0)=="CATCH") { + if(f0.at(0)=="CATCH") { RDCatchEvent *evt=new RDCatchEvent(); if(!evt->read(msg)) { rda->syslog(LOG_INFO,"invalid catch event received from %s", diff --git a/tests/notification_test.cpp b/tests/notification_test.cpp index 3918151b..7a9e60bd 100644 --- a/tests/notification_test.cpp +++ b/tests/notification_test.cpp @@ -1,8 +1,8 @@ -// upload_test.cpp +// notification_test.cpp // -// Test Rivendell file uploading. +// Test Rivendell RDNotification class. // -// (C) Copyright 2019-2021 Fred Gleason +// (C) Copyright 2019-2022 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as diff --git a/tests/notification_test.h b/tests/notification_test.h index 72c93a12..61ca43e9 100644 --- a/tests/notification_test.h +++ b/tests/notification_test.h @@ -1,6 +1,6 @@ // upload_test.h // -// Test Rivendell Notifications +// Test Rivendell RDNotification class // // (C) Copyright 2019 Fred Gleason //