1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

Option to disable RTP when constructing the AudioNetSink

This commit is contained in:
f4exb 2018-03-27 08:13:06 +02:00
parent ef69dd22fa
commit e64ed09308
3 changed files with 11 additions and 6 deletions

View File

@ -65,7 +65,7 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_audioFifo, getInputMessageQueue());
m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate();
m_audioNetSink = new AudioNetSink(0); // parent thread allocated dynamically
m_audioNetSink = new AudioNetSink(0, false, false); // parent thread allocated dynamically
m_audioNetSink->setDestination(m_settings.m_udpAddress, m_settings.m_udpPort);
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);

View File

@ -23,14 +23,17 @@
const int AudioNetSink::m_udpBlockSize = 512;
AudioNetSink::AudioNetSink(QObject *parent, bool stereo) :
AudioNetSink::AudioNetSink(QObject *parent, bool stereo, bool useRTP) :
m_type(SinkUDP),
m_rtpBufferAudio(0),
m_bufferIndex(0),
m_port(9998)
{
m_udpSocket = new QUdpSocket(parent);
m_rtpBufferAudio = new RTPSink(m_udpSocket, stereo);
if (useRTP) {
m_rtpBufferAudio = new RTPSink(m_udpSocket, stereo);
}
}
AudioNetSink::~AudioNetSink()
@ -44,7 +47,7 @@ AudioNetSink::~AudioNetSink()
bool AudioNetSink::isRTPCapable() const
{
return m_rtpBufferAudio->isValid();
return m_rtpBufferAudio && m_rtpBufferAudio->isValid();
}
bool AudioNetSink::selectType(SinkType type)
@ -91,7 +94,9 @@ void AudioNetSink::deleteDestination(const QString& address, uint16_t port)
void AudioNetSink::setParameters(bool stereo, int sampleRate)
{
m_rtpBufferAudio->setPayloadInformation(stereo ? RTPSink::PayloadL16Stereo : RTPSink::PayloadL16Mono, sampleRate);
if (m_rtpBufferAudio) {
m_rtpBufferAudio->setPayloadInformation(stereo ? RTPSink::PayloadL16Stereo : RTPSink::PayloadL16Mono, sampleRate);
}
}
void AudioNetSink::write(qint16 sample)

View File

@ -37,7 +37,7 @@ public:
SinkRTP
} SinkType;
AudioNetSink(QObject *parent, bool stereo = false);
AudioNetSink(QObject *parent, bool stereo = false, bool useRTP = true);
~AudioNetSink();
void setDestination(const QString& address, uint16_t port);