From 44552e26efd08070b1051ff2b319a473d8d01110 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 6 Feb 2018 01:18:35 +0100 Subject: [PATCH] Revert "AM demod: implemented use RTP protocol for audio over UDP" This reverts commit 9cf57f5aca995670ec61d8e23963c9ccd60401fc. --- plugins/channelrx/demodam/amdemod.cpp | 34 +++---------------- plugins/channelrx/demodam/amdemod.h | 13 ++----- plugins/channelrx/demodam/amdemodgui.cpp | 11 ------ plugins/channelrx/demodam/amdemodgui.h | 1 - plugins/channelrx/demodam/amdemodgui.ui | 13 ------- plugins/channelrx/demodam/amdemodplugin.cpp | 2 +- plugins/channelrx/demodam/amdemodsettings.cpp | 4 --- plugins/channelrx/demodam/amdemodsettings.h | 1 - 8 files changed, 8 insertions(+), 71 deletions(-) diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index 716074a00..818fb28d1 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -57,8 +57,7 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) : m_magsq = 0.0; DSPEngine::instance()->addAudioSink(&m_audioFifo); - m_audioNetSink = new AudioNetSink(this); - m_audioNetSink->setDestination(m_settings.m_udpAddress, m_settings.m_udpPort); + m_udpBufferAudio = new UDPSink(this, m_udpBlockSize, m_settings.m_udpPort); m_channelizer = new DownChannelizer(this); m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this); @@ -72,18 +71,13 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) : AMDemod::~AMDemod() { DSPEngine::instance()->removeAudioSink(&m_audioFifo); - delete m_audioNetSink; + delete m_udpBufferAudio; m_deviceAPI->removeChannelAPI(this); m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; } -bool AMDemod::isAudioNetSinkRTPCapable() const -{ - return m_audioNetSink && m_audioNetSink->isRTPCapable(); -} - void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused))) { Complex ci; @@ -220,7 +214,6 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force) << " m_audioMute: " << settings.m_audioMute << " m_bandpassEnable: " << settings.m_bandpassEnable << " m_copyAudioToUDP: " << settings.m_copyAudioToUDP - << " m_copyAudioUseRTP" << settings.m_copyAudioUseRTP << " m_udpAddress: " << settings.m_udpAddress << " m_udpPort: " << settings.m_udpPort << " force: " << force; @@ -245,27 +238,8 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force) if ((m_settings.m_udpAddress != settings.m_udpAddress) || (m_settings.m_udpPort != settings.m_udpPort) || force) { - m_audioNetSink->setDestination(settings.m_udpAddress, settings.m_udpPort); - } - - if ((settings.m_copyAudioUseRTP != m_settings.m_copyAudioUseRTP) || force) - { - if (settings.m_copyAudioUseRTP) - { - if (m_audioNetSink->selectType(AudioNetSink::SinkRTP)) { - qDebug("AMDemod::applySettings: set audio sink to RTP mode"); - } else { - qWarning("AMDemod::applySettings: RTP support for audio sink not available. Fall back too UDP"); - } - } - else - { - if (m_audioNetSink->selectType(AudioNetSink::SinkUDP)) { - qDebug("AMDemod::applySettings: set audio sink to UDP mode"); - } else { - qWarning("AMDemod::applySettings: failed to set audio sink to UDP mode"); - } - } + m_udpBufferAudio->setAddress(const_cast(settings.m_udpAddress)); + m_udpBufferAudio->setPort(settings.m_udpPort); } m_settings = settings; diff --git a/plugins/channelrx/demodam/amdemod.h b/plugins/channelrx/demodam/amdemod.h index a72c1dec2..e42688151 100644 --- a/plugins/channelrx/demodam/amdemod.h +++ b/plugins/channelrx/demodam/amdemod.h @@ -28,7 +28,6 @@ #include "dsp/agc.h" #include "dsp/bandpass.h" #include "audio/audiofifo.h" -#include "audio/audionetsink.h" #include "util/message.h" #include "amdemodsettings.h" @@ -114,8 +113,6 @@ public: m_magsqCount = 0; } - bool isAudioNetSinkRTPCapable() const; - static const QString m_channelIdURI; static const QString m_channelId; @@ -153,7 +150,7 @@ private: AudioVector m_audioBuffer; uint32_t m_audioBufferFill; AudioFifo m_audioFifo; - AudioNetSink *m_audioNetSink; + UDPSink *m_udpBufferAudio; static const int m_udpBlockSize; @@ -209,18 +206,14 @@ private: Real attack = (m_squelchCount - 0.05f * m_settings.m_audioSampleRate) / (0.05f * m_settings.m_audioSampleRate); sample = demod * attack * 2048 * m_settings.m_volume; - if (m_settings.m_copyAudioToUDP) { - m_audioNetSink->write(demod * attack * SDR_RX_SCALEF); - } + if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(demod * attack * SDR_RX_SCALEF); m_squelchOpen = true; } else { sample = 0; - if (m_settings.m_copyAudioToUDP) { - m_audioNetSink->write(0); - } + if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(0); m_squelchOpen = false; } diff --git a/plugins/channelrx/demodam/amdemodgui.cpp b/plugins/channelrx/demodam/amdemodgui.cpp index 316c71a4b..6302d7a26 100644 --- a/plugins/channelrx/demodam/amdemodgui.cpp +++ b/plugins/channelrx/demodam/amdemodgui.cpp @@ -153,12 +153,6 @@ void AMDemodGUI::on_copyAudioToUDP_toggled(bool checked) applySettings(); } -void AMDemodGUI::on_useRTP_toggled(bool checked) -{ - m_settings.m_copyAudioUseRTP = checked; - applySettings(); -} - void AMDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused))) { /* @@ -209,7 +203,6 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); - ui->useRTP->setEnabled(m_amDemod->isAudioNetSinkRTPCapable()); m_channelMarker.blockSignals(true); m_channelMarker.setColor(Qt::yellow); @@ -292,10 +285,6 @@ void AMDemodGUI::displaySettings() ui->bandpassEnable->setChecked(m_settings.m_bandpassEnable); ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP); - if (m_amDemod->isAudioNetSinkRTPCapable()) { - ui->useRTP->setChecked(m_settings.m_copyAudioUseRTP); - } - blockApplySettings(false); } diff --git a/plugins/channelrx/demodam/amdemodgui.h b/plugins/channelrx/demodam/amdemodgui.h index 1cb7886cc..f853cc220 100644 --- a/plugins/channelrx/demodam/amdemodgui.h +++ b/plugins/channelrx/demodam/amdemodgui.h @@ -72,7 +72,6 @@ private slots: void on_squelch_valueChanged(int value); void on_audioMute_toggled(bool checked); void on_copyAudioToUDP_toggled(bool copy); - void on_useRTP_toggled(bool checked); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDialogCalled(const QPoint& p); void tick(); diff --git a/plugins/channelrx/demodam/amdemodgui.ui b/plugins/channelrx/demodam/amdemodgui.ui index 3444f00a0..01b80ae3f 100644 --- a/plugins/channelrx/demodam/amdemodgui.ui +++ b/plugins/channelrx/demodam/amdemodgui.ui @@ -199,19 +199,6 @@ - - - - Use RTP protocol for copy audio to UDP - - - R - - - true - - - diff --git a/plugins/channelrx/demodam/amdemodplugin.cpp b/plugins/channelrx/demodam/amdemodplugin.cpp index 09ae64f70..d8b44e840 100644 --- a/plugins/channelrx/demodam/amdemodplugin.cpp +++ b/plugins/channelrx/demodam/amdemodplugin.cpp @@ -8,7 +8,7 @@ const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = { QString("AM Demodulator"), - QString("3.12.0"), + QString("3.10.1"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelrx/demodam/amdemodsettings.cpp b/plugins/channelrx/demodam/amdemodsettings.cpp index 454ac6a1e..2af7ceaab 100644 --- a/plugins/channelrx/demodam/amdemodsettings.cpp +++ b/plugins/channelrx/demodam/amdemodsettings.cpp @@ -37,7 +37,6 @@ void AMDemodSettings::resetToDefaults() m_audioMute = false; m_bandpassEnable = false; m_copyAudioToUDP = false; - m_copyAudioUseRTP = false; m_udpAddress = "127.0.0.1"; m_udpPort = 9999; m_rgbColor = QColor(255, 255, 0).rgb(); @@ -59,8 +58,6 @@ QByteArray AMDemodSettings::serialize() const s.writeU32(7, m_rgbColor); s.writeBool(8, m_bandpassEnable); s.writeString(9, m_title); - s.writeBool(10, m_copyAudioUseRTP); - return s.final(); } @@ -96,7 +93,6 @@ bool AMDemodSettings::deserialize(const QByteArray& data) d.readU32(7, &m_rgbColor); d.readBool(8, &m_bandpassEnable, false); d.readString(9, &m_title, "AM Demodulator"); - d.readBool(15, &m_copyAudioUseRTP, false); return true; } diff --git a/plugins/channelrx/demodam/amdemodsettings.h b/plugins/channelrx/demodam/amdemodsettings.h index 4c908a144..c469246f6 100644 --- a/plugins/channelrx/demodam/amdemodsettings.h +++ b/plugins/channelrx/demodam/amdemodsettings.h @@ -31,7 +31,6 @@ struct AMDemodSettings bool m_audioMute; bool m_bandpassEnable; bool m_copyAudioToUDP; - bool m_copyAudioUseRTP; QString m_udpAddress; quint16 m_udpPort; quint32 m_rgbColor;