1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-25 05:25:27 -04:00

DSD demod: implement RTP over UDP for audio copy final

This commit is contained in:
f4exb 2018-03-09 06:54:45 +01:00
parent 5fa4454b5a
commit 46f80e2a15
2 changed files with 15 additions and 6 deletions

View File

@ -308,6 +308,10 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addChannelMarker(&m_channelMarker);
m_deviceUISet->addRollupWidget(this); m_deviceUISet->addRollupWidget(this);
if (!m_dsdDemod->isAudioNetSinkRTPCapable()) {
ui->useRTP->hide();
}
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor())); connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));

View File

@ -78,12 +78,6 @@ uint AudioFifo::write(const quint8* data, uint32_t numSamples, int timeout_ms)
uint32_t remaining; uint32_t remaining;
uint32_t copyLen; uint32_t copyLen;
if (m_copyToUDP && m_audioNetSink)
{
//m_udpSink->write((AudioSample *) data, numSamples);
m_audioNetSink->write((AudioSample *) data, numSamples);
}
if(m_fifo == 0) if(m_fifo == 0)
{ {
return 0; return 0;
@ -223,6 +217,17 @@ uint AudioFifo::read(quint8* data, uint32_t numSamples, int timeout_ms)
copyLen = MIN(remaining, m_fill); copyLen = MIN(remaining, m_fill);
copyLen = MIN(copyLen, m_size - m_head); copyLen = MIN(copyLen, m_size - m_head);
memcpy(data, m_fifo + (m_head * m_sampleSize), copyLen * m_sampleSize); memcpy(data, m_fifo + (m_head * m_sampleSize), copyLen * m_sampleSize);
if (m_copyToUDP && m_audioNetSink)
{
for (quint8 *p = data; p < data + copyLen* m_sampleSize;)
{
AudioSample *a = (AudioSample *) p;
m_audioNetSink->write((a->l + a->r)/2);
p += m_sampleSize;
}
}
m_head += copyLen; m_head += copyLen;
m_head %= m_size; m_head %= m_size;
m_fill -= copyLen; m_fill -= copyLen;