1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-26 06:46:34 -04:00

Fixed RTP stereo

This commit is contained in:
f4exb 2018-03-30 01:19:02 +02:00
parent b244222667
commit d22b5ecd05
3 changed files with 35 additions and 2 deletions

View File

@ -148,8 +148,7 @@ void AudioNetSink::write(qint16 lSample, qint16 rSample)
}
else if (m_type == SinkRTP)
{
m_rtpBufferAudio->write((uint8_t *) &lSample);
m_rtpBufferAudio->write((uint8_t *) &rSample);
m_rtpBufferAudio->write((uint8_t *) &lSample, (uint8_t *) &rSample);
}
}

View File

@ -212,6 +212,39 @@ void RTPSink::write(const uint8_t *sampleByte)
}
}
void RTPSink::write(const uint8_t *sampleByteL, const uint8_t *sampleByteR)
{
QMutexLocker locker(&m_mutex);
if (m_sampleBufferIndex < m_packetSamples)
{
writeNetBuf(&m_byteBuffer[m_sampleBufferIndex*m_sampleBytes],
sampleByteL,
elemLength(m_payloadType),
m_sampleBytes,
m_endianReverse);
writeNetBuf(&m_byteBuffer[m_sampleBufferIndex*m_sampleBytes + elemLength(m_payloadType)],
sampleByteR,
elemLength(m_payloadType),
m_sampleBytes,
m_endianReverse);
m_sampleBufferIndex++;
}
else
{
int status = m_rtpSession.SendPacket((const void *) m_byteBuffer, (std::size_t) m_bufferSize);
if (status < 0) {
qCritical("RTPSink::write: cannot write packet: %s", qrtplib::RTPGetErrorString(status).c_str());
}
writeNetBuf(&m_byteBuffer[0], sampleByteL, elemLength(m_payloadType), m_sampleBytes, m_endianReverse);
writeNetBuf(&m_byteBuffer[2], sampleByteR, elemLength(m_payloadType), m_sampleBytes, m_endianReverse);
m_sampleBufferIndex = 1;
}
}
void RTPSink::write(const uint8_t *samples, int nbSamples)
{
int samplesIndex = 0;

View File

@ -55,6 +55,7 @@ public:
void addDestination(const QString& address, uint16_t port);
void write(const uint8_t *sampleByte);
void write(const uint8_t *sampleByteL, const uint8_t *sampleByteR);
void write(const uint8_t *sampleByte, int nbSamples);
protected: