Fixed RTP stereo

pull/162/head
f4exb 2018-03-30 01:19:02 +02:00
rodzic b244222667
commit d22b5ecd05
3 zmienionych plików z 35 dodań i 2 usunięć

Wyświetl plik

@ -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);
}
}

Wyświetl plik

@ -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;

Wyświetl plik

@ -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: