|
|
|
|
@ -19,9 +19,9 @@
@@ -19,9 +19,9 @@
|
|
|
|
|
#include "dsp/dsptypes.h" |
|
|
|
|
#include <algorithm> |
|
|
|
|
|
|
|
|
|
RTPSink::RTPSink(QUdpSocket *udpSocket, bool stereo) : |
|
|
|
|
RTPSink::RTPSink(QUdpSocket *udpSocket, int sampleRate, bool stereo) : |
|
|
|
|
m_payloadType(stereo ? RTPSink::PayloadL16Stereo : RTPSink::PayloadL16Mono), |
|
|
|
|
m_sampleRate(48000), |
|
|
|
|
m_sampleRate(sampleRate), |
|
|
|
|
m_sampleBytes(0), |
|
|
|
|
m_packetSamples(0), |
|
|
|
|
m_bufferSize(0), |
|
|
|
|
@ -76,7 +76,7 @@ void RTPSink::setPayloadInformation(PayloadType payloadType, int sampleRate)
@@ -76,7 +76,7 @@ void RTPSink::setPayloadInformation(PayloadType payloadType, int sampleRate)
|
|
|
|
|
uint32_t timestampinc; |
|
|
|
|
QMutexLocker locker(&m_mutex); |
|
|
|
|
|
|
|
|
|
qDebug("RTPSink::setPayloadType: %d sampleRate: %d", payloadType, sampleRate); |
|
|
|
|
qDebug("RTPSink::setPayloadInformation: %d sampleRate: %d", payloadType, sampleRate); |
|
|
|
|
|
|
|
|
|
switch (payloadType) |
|
|
|
|
{ |
|
|
|
|
@ -107,9 +107,9 @@ void RTPSink::setPayloadInformation(PayloadType payloadType, int sampleRate)
@@ -107,9 +107,9 @@ void RTPSink::setPayloadInformation(PayloadType payloadType, int sampleRate)
|
|
|
|
|
int status = m_rtpSession.SetTimestampUnit(1.0 / (double) m_sampleRate); |
|
|
|
|
|
|
|
|
|
if (status < 0) { |
|
|
|
|
qCritical("RTPSink::setPayloadType: cannot set timestamp unit: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qCritical("RTPSink::setPayloadInformation: cannot set timestamp unit: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} else { |
|
|
|
|
qDebug("RTPSink::setPayloadType: timestamp unit set to %f: %s", |
|
|
|
|
qDebug("RTPSink::setPayloadInformation: timestamp unit set to %f: %s", |
|
|
|
|
1.0 / (double) m_sampleRate, |
|
|
|
|
qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} |
|
|
|
|
@ -117,25 +117,26 @@ void RTPSink::setPayloadInformation(PayloadType payloadType, int sampleRate)
@@ -117,25 +117,26 @@ void RTPSink::setPayloadInformation(PayloadType payloadType, int sampleRate)
|
|
|
|
|
status = m_rtpSession.SetDefaultMark(false); |
|
|
|
|
|
|
|
|
|
if (status < 0) { |
|
|
|
|
qCritical("RTPSink::setPayloadType: cannot set default mark: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qCritical("RTPSink::setPayloadInformation: cannot set default mark: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} else { |
|
|
|
|
qDebug("RTPSink::setPayloadType: set default mark to false: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qDebug("RTPSink::setPayloadInformation: set default mark to false: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = m_rtpSession.SetDefaultTimestampIncrement(timestampinc); |
|
|
|
|
|
|
|
|
|
if (status < 0) { |
|
|
|
|
qCritical("RTPSink::setPayloadType: cannot set default timestamp increment: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qCritical("RTPSink::setPayloadInformation: cannot set default timestamp increment: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} else { |
|
|
|
|
qDebug("RTPSink::setPayloadType: set default timestamp increment to %d: %s", timestampinc, qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qDebug("RTPSink::setPayloadInformation: set default timestamp increment to %d: %s", timestampinc, qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = m_rtpSession.SetMaximumPacketSize(m_bufferSize+40); |
|
|
|
|
int maximumPacketSize = std::max(m_bufferSize+40, RTP_MINPACKETSIZE); |
|
|
|
|
status = m_rtpSession.SetMaximumPacketSize(maximumPacketSize); |
|
|
|
|
|
|
|
|
|
if (status < 0) { |
|
|
|
|
qCritical("RTPSink::setPayloadType: cannot set maximum packet size: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qCritical("RTPSink::setPayloadInformation: cannot set maximum packet size: %s", qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} else { |
|
|
|
|
qDebug("RTPSink::setPayloadType: set maximum packet size to %d bytes: %s", m_bufferSize+40, qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
qDebug("RTPSink::setPayloadInformation: set maximum packet size to %d bytes: %s", maximumPacketSize, qrtplib::RTPGetErrorString(status).c_str()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|