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

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

This reverts commit d946ceffc8.
This commit is contained in:
f4exb 2018-02-06 01:18:13 +01:00
parent dda124f1fb
commit 0d2c0ca117
8 changed files with 10 additions and 73 deletions

View File

@ -26,7 +26,6 @@
#include <dsp/downchannelizer.h> #include <dsp/downchannelizer.h>
#include "dsp/threadedbasebandsamplesink.h" #include "dsp/threadedbasebandsamplesink.h"
#include "device/devicesourceapi.h" #include "device/devicesourceapi.h"
#include "audio/audionetsink.h"
#include "rdsparser.h" #include "rdsparser.h"
#include "bfmdemod.h" #include "bfmdemod.h"
@ -85,8 +84,7 @@ BFMDemod::BFMDemod(DeviceSourceAPI *deviceAPI) :
m_audioBufferFill = 0; m_audioBufferFill = 0;
DSPEngine::instance()->addAudioSink(&m_audioFifo); DSPEngine::instance()->addAudioSink(&m_audioFifo);
m_audioNetSink = new AudioNetSink(this, true); // true = stereo m_udpBufferAudio = new UDPSink<AudioSample>(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);
@ -105,7 +103,7 @@ BFMDemod::~BFMDemod()
} }
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);
@ -113,11 +111,6 @@ BFMDemod::~BFMDemod()
delete m_channelizer; delete m_channelizer;
} }
bool BFMDemod::isAudioNetSinkRTPCapable() const
{
return m_audioNetSink && m_audioNetSink->isRTPCapable();
}
void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused))) void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused)))
{ {
Complex ci, cs, cr; Complex ci, cs, cr;
@ -243,17 +236,13 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
{ {
m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume);
m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume);
if (m_settings.m_copyAudioToUDP) { if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(m_audioBuffer[m_audioBufferFill]);
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill]);
}
} }
else else
{ {
m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume);
m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume);
if (m_settings.m_copyAudioToUDP) { if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(m_audioBuffer[m_audioBufferFill]);
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill]);
}
} }
} }
else else
@ -263,9 +252,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
quint16 sample = (qint16)(deemph * (1<<12) * m_settings.m_volume); quint16 sample = (qint16)(deemph * (1<<12) * m_settings.m_volume);
m_audioBuffer[m_audioBufferFill].l = sample; m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample; m_audioBuffer[m_audioBufferFill].r = sample;
if (m_settings.m_copyAudioToUDP) { if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(m_audioBuffer[m_audioBufferFill]);
m_audioNetSink->write(m_audioBuffer[m_audioBufferFill]);
}
} }
++m_audioBufferFill; ++m_audioBufferFill;
@ -432,7 +419,6 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force)
<< " m_showPilot: " << settings.m_showPilot << " m_showPilot: " << settings.m_showPilot
<< " m_rdsActive: " << settings.m_rdsActive << " m_rdsActive: " << settings.m_rdsActive
<< " 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;
@ -497,27 +483,8 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force)
if ((settings.m_udpAddress != m_settings.m_udpAddress) if ((settings.m_udpAddress != m_settings.m_udpAddress)
|| (settings.m_udpPort != m_settings.m_udpPort) || force) || (settings.m_udpPort != m_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("BFMDemod::applySettings: set audio sink to RTP mode");
} else {
qWarning("BFMDemod::applySettings: RTP support for audio sink not available. Fall back too UDP");
}
}
else
{
if (m_audioNetSink->selectType(AudioNetSink::SinkUDP)) {
qDebug("BFMDemod::applySettings: set audio sink to UDP mode");
} else {
qWarning("BFMDemod::applySettings: failed to set audio sink to UDP mode");
}
}
} }
m_settings = settings; m_settings = settings;

View File

@ -33,6 +33,7 @@
#include "dsp/phasediscri.h" #include "dsp/phasediscri.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
#include "util/message.h" #include "util/message.h"
#include "util/udpsink.h"
#include "rdsparser.h" #include "rdsparser.h"
#include "rdsdecoder.h" #include "rdsdecoder.h"
@ -42,7 +43,6 @@
class DeviceSourceAPI; class DeviceSourceAPI;
class ThreadedBasebandSampleSink; class ThreadedBasebandSampleSink;
class DownChannelizer; class DownChannelizer;
class AudioNetSink;
class BFMDemod : public BasebandSampleSink, public ChannelSinkAPI { class BFMDemod : public BasebandSampleSink, public ChannelSinkAPI {
public: public:
@ -153,7 +153,6 @@ public:
} }
RDSParser& getRDSParser() { return m_rdsParser; } RDSParser& getRDSParser() { return m_rdsParser; }
bool isAudioNetSinkRTPCapable() const;
static const QString m_channelIdURI; static const QString m_channelIdURI;
static const QString m_channelId; static const QString m_channelId;
@ -222,7 +221,7 @@ private:
static const int default_excursion = 750000; // +/- 75 kHz static const int default_excursion = 750000; // +/- 75 kHz
PhaseDiscriminators m_phaseDiscri; PhaseDiscriminators m_phaseDiscri;
AudioNetSink *m_audioNetSink; UDPSink<AudioSample> *m_udpBufferAudio;
static const int m_udpBlockSize; static const int m_udpBlockSize;

View File

@ -207,12 +207,6 @@ void BFMDemodGUI::on_copyAudioToUDP_toggled(bool copy)
applySettings(); applySettings();
} }
void BFMDemodGUI::on_useRTP_toggled(bool checked)
{
m_settings.m_copyAudioUseRTP = checked;
applySettings();
}
void BFMDemodGUI::on_showPilot_clicked() void BFMDemodGUI::on_showPilot_clicked()
{ {
m_settings.m_showPilot = ui->showPilot->isChecked(); m_settings.m_showPilot = ui->showPilot->isChecked();
@ -389,7 +383,6 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->g00AltFrequenciesBox->setEnabled(false); ui->g00AltFrequenciesBox->setEnabled(false);
ui->g14MappedFrequencies->setEnabled(false); ui->g14MappedFrequencies->setEnabled(false);
ui->g14AltFrequencies->setEnabled(false); ui->g14AltFrequencies->setEnabled(false);
ui->useRTP->setEnabled(m_bfmDemod->isAudioNetSinkRTPCapable());
rdsUpdateFixedFields(); rdsUpdateFixedFields();
rdsUpdate(true); rdsUpdate(true);
@ -463,10 +456,6 @@ void BFMDemodGUI::displaySettings()
ui->rds->setChecked(m_settings.m_rdsActive); ui->rds->setChecked(m_settings.m_rdsActive);
ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP); ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP);
if (m_bfmDemod->isAudioNetSinkRTPCapable()) {
ui->useRTP->setChecked(m_settings.m_copyAudioUseRTP);
}
blockApplySettings(false); blockApplySettings(false);
} }

View File

@ -109,7 +109,6 @@ private slots:
void on_showPilot_clicked(); void on_showPilot_clicked();
void on_rds_clicked(); void on_rds_clicked();
void on_copyAudioToUDP_toggled(bool copy); void on_copyAudioToUDP_toggled(bool copy);
void on_useRTP_toggled(bool checked);
void on_g14ProgServiceNames_currentIndexChanged(int index); void on_g14ProgServiceNames_currentIndexChanged(int index);
void on_clearData_clicked(bool checked); void on_clearData_clicked(bool checked);
void on_g00AltFrequenciesBox_activated(int index); void on_g00AltFrequenciesBox_activated(int index);

View File

@ -321,19 +321,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

@ -47,7 +47,6 @@ void BFMDemodSettings::resetToDefaults()
m_showPilot = false; m_showPilot = false;
m_rdsActive = false; m_rdsActive = 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(80, 120, 228).rgb(); m_rgbColor = QColor(80, 120, 228).rgb();
@ -76,7 +75,6 @@ QByteArray BFMDemodSettings::serialize() const
} }
s.writeString(12, m_title); s.writeString(12, m_title);
s.writeBool(13, m_copyAudioUseRTP);
return s.final(); return s.final();
} }
@ -125,7 +123,6 @@ bool BFMDemodSettings::deserialize(const QByteArray& data)
} }
d.readString(12, &m_title, "Broadcast FM Demod"); d.readString(12, &m_title, "Broadcast FM Demod");
d.readBool(13, &m_copyAudioUseRTP, false);
return true; return true;
} }

View File

@ -34,7 +34,6 @@ struct BFMDemodSettings
bool m_showPilot; bool m_showPilot;
bool m_rdsActive; bool m_rdsActive;
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;

View File

@ -25,7 +25,7 @@
const PluginDescriptor BFMPlugin::m_pluginDescriptor = { const PluginDescriptor BFMPlugin::m_pluginDescriptor = {
QString("Broadcast FM Demodulator"), QString("Broadcast FM 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,