mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-31 12:17:51 -04:00
Copy audio to UDP/RTP: Opus implementation (1)
This commit is contained in:
parent
c1fb4bb46c
commit
a269462b55
@ -206,6 +206,10 @@ void AudioNetSink::write(qint16 isample)
|
|||||||
m_udpSocket->writeDatagram((const char*) m_data, (qint64 ) m_udpBlockSize, m_address, m_port);
|
m_udpSocket->writeDatagram((const char*) m_data, (qint64 ) m_udpBlockSize, m_address, m_port);
|
||||||
m_bufferIndex = 0;
|
m_bufferIndex = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (m_codec == CodecOpus)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -242,6 +246,11 @@ void AudioNetSink::write(qint16 isample)
|
|||||||
if (m_bufferIndex == 2*m_udpBlockSize) {
|
if (m_bufferIndex == 2*m_udpBlockSize) {
|
||||||
m_g722.encode((uint8_t *) m_data, (const int16_t*) &m_data[m_udpBlockSize], 2*m_udpBlockSize);
|
m_g722.encode((uint8_t *) m_data, (const int16_t*) &m_data[m_udpBlockSize], 2*m_udpBlockSize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CodecOpus:
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CodecL16:
|
case CodecL16:
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
static const int m_udpBlockSize;
|
static const int m_udpBlockSize;
|
||||||
static const int m_dataBlockSize = 65536; // room for G722 conversion (64000 = 12800*5 largest to date)
|
static const int m_dataBlockSize = 65536; // room for G722 conversion (64000 = 12800*5 largest to date)
|
||||||
static const int m_g722BlockSize = 12800; // number of resulting G722 bytes (80*20ms frames)
|
static const int m_g722BlockSize = 12800; // number of resulting G722 bytes (80*20ms frames)
|
||||||
static const int m_opusBlockSize = 960*4; // provision for 20ms of 2 int16 channels at 48 kS/s
|
static const int m_opusBlockSize = 960*2; // provision for 20ms of 2 int16 channels at 48 kS/s
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDecimationFilters();
|
void setDecimationFilters();
|
||||||
@ -87,6 +87,7 @@ protected:
|
|||||||
uint32_t m_decimation;
|
uint32_t m_decimation;
|
||||||
uint32_t m_decimationCount;
|
uint32_t m_decimationCount;
|
||||||
char m_data[m_dataBlockSize];
|
char m_data[m_dataBlockSize];
|
||||||
|
uint16_t m_opusIn[m_opusBlockSize];
|
||||||
unsigned int m_bufferIndex;
|
unsigned int m_bufferIndex;
|
||||||
QHostAddress m_address;
|
QHostAddress m_address;
|
||||||
unsigned int m_port;
|
unsigned int m_port;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user