1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

Revert "AM demod: implemented use RTP protocol for audio over UDP"

This reverts commit 9cf57f5aca.
This commit is contained in:
f4exb 2018-02-06 01:18:35 +01:00
parent 0d2c0ca117
commit 44552e26ef
8 changed files with 8 additions and 71 deletions

View File

@ -57,8 +57,7 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
m_magsq = 0.0; m_magsq = 0.0;
DSPEngine::instance()->addAudioSink(&m_audioFifo); DSPEngine::instance()->addAudioSink(&m_audioFifo);
m_audioNetSink = new AudioNetSink(this); m_udpBufferAudio = new UDPSink<qint16>(this, m_udpBlockSize, m_settings.m_udpPort);
m_audioNetSink->setDestination(m_settings.m_udpAddress, m_settings.m_udpPort);
m_channelizer = new DownChannelizer(this); m_channelizer = new DownChannelizer(this);
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this); m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
@ -72,18 +71,13 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
AMDemod::~AMDemod() AMDemod::~AMDemod()
{ {
DSPEngine::instance()->removeAudioSink(&m_audioFifo); DSPEngine::instance()->removeAudioSink(&m_audioFifo);
delete m_audioNetSink; delete m_udpBufferAudio;
m_deviceAPI->removeChannelAPI(this); m_deviceAPI->removeChannelAPI(this);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer); m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer; delete m_threadedChannelizer;
delete m_channelizer; 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))) void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused)))
{ {
Complex ci; Complex ci;
@ -220,7 +214,6 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
<< " m_audioMute: " << settings.m_audioMute << " m_audioMute: " << settings.m_audioMute
<< " m_bandpassEnable: " << settings.m_bandpassEnable << " m_bandpassEnable: " << settings.m_bandpassEnable
<< " m_copyAudioToUDP: " << settings.m_copyAudioToUDP << " m_copyAudioToUDP: " << settings.m_copyAudioToUDP
<< " m_copyAudioUseRTP" << settings.m_copyAudioUseRTP
<< " m_udpAddress: " << settings.m_udpAddress << " m_udpAddress: " << settings.m_udpAddress
<< " m_udpPort: " << settings.m_udpPort << " m_udpPort: " << settings.m_udpPort
<< " force: " << force; << " force: " << force;
@ -245,27 +238,8 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
if ((m_settings.m_udpAddress != settings.m_udpAddress) if ((m_settings.m_udpAddress != settings.m_udpAddress)
|| (m_settings.m_udpPort != settings.m_udpPort) || force) || (m_settings.m_udpPort != settings.m_udpPort) || force)
{ {
m_audioNetSink->setDestination(settings.m_udpAddress, settings.m_udpPort); m_udpBufferAudio->setAddress(const_cast<QString&>(settings.m_udpAddress));
} m_udpBufferAudio->setPort(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_settings = settings; m_settings = settings;

View File

@ -28,7 +28,6 @@
#include "dsp/agc.h" #include "dsp/agc.h"
#include "dsp/bandpass.h" #include "dsp/bandpass.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
#include "audio/audionetsink.h"
#include "util/message.h" #include "util/message.h"
#include "amdemodsettings.h" #include "amdemodsettings.h"
@ -114,8 +113,6 @@ public:
m_magsqCount = 0; m_magsqCount = 0;
} }
bool isAudioNetSinkRTPCapable() const;
static const QString m_channelIdURI; static const QString m_channelIdURI;
static const QString m_channelId; static const QString m_channelId;
@ -153,7 +150,7 @@ private:
AudioVector m_audioBuffer; AudioVector m_audioBuffer;
uint32_t m_audioBufferFill; uint32_t m_audioBufferFill;
AudioFifo m_audioFifo; AudioFifo m_audioFifo;
AudioNetSink *m_audioNetSink; UDPSink<qint16> *m_udpBufferAudio;
static const int m_udpBlockSize; 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); Real attack = (m_squelchCount - 0.05f * m_settings.m_audioSampleRate) / (0.05f * m_settings.m_audioSampleRate);
sample = demod * attack * 2048 * m_settings.m_volume; sample = demod * attack * 2048 * m_settings.m_volume;
if (m_settings.m_copyAudioToUDP) { if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(demod * attack * SDR_RX_SCALEF);
m_audioNetSink->write(demod * attack * SDR_RX_SCALEF);
}
m_squelchOpen = true; m_squelchOpen = true;
} }
else else
{ {
sample = 0; sample = 0;
if (m_settings.m_copyAudioToUDP) { if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(0);
m_audioNetSink->write(0);
}
m_squelchOpen = false; m_squelchOpen = false;
} }

View File

@ -153,12 +153,6 @@ void AMDemodGUI::on_copyAudioToUDP_toggled(bool checked)
applySettings(); 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))) 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->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
ui->useRTP->setEnabled(m_amDemod->isAudioNetSinkRTPCapable());
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
m_channelMarker.setColor(Qt::yellow); m_channelMarker.setColor(Qt::yellow);
@ -292,10 +285,6 @@ void AMDemodGUI::displaySettings()
ui->bandpassEnable->setChecked(m_settings.m_bandpassEnable); ui->bandpassEnable->setChecked(m_settings.m_bandpassEnable);
ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP); ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP);
if (m_amDemod->isAudioNetSinkRTPCapable()) {
ui->useRTP->setChecked(m_settings.m_copyAudioUseRTP);
}
blockApplySettings(false); blockApplySettings(false);
} }

View File

@ -72,7 +72,6 @@ private slots:
void on_squelch_valueChanged(int value); void on_squelch_valueChanged(int value);
void on_audioMute_toggled(bool checked); void on_audioMute_toggled(bool checked);
void on_copyAudioToUDP_toggled(bool copy); void on_copyAudioToUDP_toggled(bool copy);
void on_useRTP_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void tick(); void tick();

View File

@ -199,19 +199,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="useRTP">
<property name="toolTip">
<string>Use RTP protocol for copy audio to UDP</string>
</property>
<property name="text">
<string>R</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -8,7 +8,7 @@
const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = { const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = {
QString("AM Demodulator"), QString("AM Demodulator"),
QString("3.12.0"), QString("3.10.1"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,

View File

@ -37,7 +37,6 @@ void AMDemodSettings::resetToDefaults()
m_audioMute = false; m_audioMute = false;
m_bandpassEnable = false; m_bandpassEnable = false;
m_copyAudioToUDP = false; m_copyAudioToUDP = false;
m_copyAudioUseRTP = false;
m_udpAddress = "127.0.0.1"; m_udpAddress = "127.0.0.1";
m_udpPort = 9999; m_udpPort = 9999;
m_rgbColor = QColor(255, 255, 0).rgb(); m_rgbColor = QColor(255, 255, 0).rgb();
@ -59,8 +58,6 @@ QByteArray AMDemodSettings::serialize() const
s.writeU32(7, m_rgbColor); s.writeU32(7, m_rgbColor);
s.writeBool(8, m_bandpassEnable); s.writeBool(8, m_bandpassEnable);
s.writeString(9, m_title); s.writeString(9, m_title);
s.writeBool(10, m_copyAudioUseRTP);
return s.final(); return s.final();
} }
@ -96,7 +93,6 @@ bool AMDemodSettings::deserialize(const QByteArray& data)
d.readU32(7, &m_rgbColor); d.readU32(7, &m_rgbColor);
d.readBool(8, &m_bandpassEnable, false); d.readBool(8, &m_bandpassEnable, false);
d.readString(9, &m_title, "AM Demodulator"); d.readString(9, &m_title, "AM Demodulator");
d.readBool(15, &m_copyAudioUseRTP, false);
return true; return true;
} }

View File

@ -31,7 +31,6 @@ struct AMDemodSettings
bool m_audioMute; bool m_audioMute;
bool m_bandpassEnable; bool m_bandpassEnable;
bool m_copyAudioToUDP; bool m_copyAudioToUDP;
bool m_copyAudioUseRTP;
QString m_udpAddress; QString m_udpAddress;
quint16 m_udpPort; quint16 m_udpPort;
quint32 m_rgbColor; quint32 m_rgbColor;