Commit 796d60a8 authored by Tristan Matthews's avatar Tristan Matthews

* #11840: audiortp: remove some global symbols/variables

parent 54e3b7fd
......@@ -48,18 +48,9 @@ class SIPCall;
namespace sfl {
// Frequency (in packet number)
#define RTP_TIMESTAMP_RESET_FREQ 100
static const int schedulingTimeout = 4000;
static const int expireTimeout = 1000000;
// G.722 VoIP is typically carried in RTP payload type 9.[2] Note that IANA records the clock rate for type 9 G.722 as 8 kHz
// (instead of 16 kHz), RFC3551[3] clarifies that this is due to a historical error and is retained in order to maintain backward
// compatibility. Consequently correct implementations represent the value 8,000 where required but encode and decode audio at 16 kHz.
static const int g722PayloadType = 9;
static const int g722RtpClockRate = 8000;
static const int g722RtpTimeincrement = 160;
inline uint32
timeval2microtimeout(const timeval& t)
......
......@@ -79,34 +79,22 @@ void AudioRtpSession::setSessionMedia(AudioCodec &audioCodec)
{
setRtpMedia(&audioCodec);
// store codec info locally
int payloadType = getCodecPayloadType();
int frameSize = getCodecFrameSize();
int smplRate = getCodecSampleRate();
bool dynamic = getHasDynamicPayload();
// G722 requires timestamp to be incremented at 8kHz
if (payloadType == g722PayloadType)
timestampIncrement_ = g722RtpTimeincrement;
else
timestampIncrement_ = frameSize;
DEBUG("Codec payload: %d", payloadType);
DEBUG("Codec sampling rate: %d", smplRate);
DEBUG("Codec frame size: %d", frameSize);
DEBUG("RTP timestamp increment: %d", timestampIncrement_);
if (payloadType == g722PayloadType) {
DEBUG("Setting G722 payload format");
queue_.setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) payloadType, g722RtpClockRate));
const ost::PayloadType payloadType = getCodecPayloadType();
if (payloadType == ost::sptG722) {
const int G722_RTP_TIME_INCREMENT = 160;
timestampIncrement_ = G722_RTP_TIME_INCREMENT;
} else
timestampIncrement_ = getCodecFrameSize();
if (payloadType == ost::sptG722) {
const int G722_RTP_CLOCK_RATE = 8000;
queue_.setPayloadFormat(ost::DynamicPayloadFormat( payloadType, G722_RTP_CLOCK_RATE));
} else {
if (dynamic) {
DEBUG("Setting dynamic payload format");
queue_.setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) payloadType, smplRate));
} else {
DEBUG("Setting static payload format");
queue_.setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) payloadType));
}
if (getHasDynamicPayload())
queue_.setPayloadFormat(ost::DynamicPayloadFormat(payloadType, getCodecSampleRate()));
else
queue_.setPayloadFormat(ost::StaticPayloadFormat(static_cast<ost::StaticPayloadType>(payloadType)));
}
}
......@@ -186,11 +174,13 @@ void AudioRtpSession::sendMicData()
void AudioRtpSession::setSessionTimeouts()
{
const int schedulingTimeout = 4000;
const int expireTimeout = 1000000;
DEBUG("Set session scheduling timeout (%d) and expireTimeout (%d)",
sfl::schedulingTimeout, sfl::expireTimeout);
schedulingTimeout, expireTimeout);
queue_.setSchedulingTimeout(sfl::schedulingTimeout);
queue_.setExpireTimeout(sfl::expireTimeout);
queue_.setSchedulingTimeout(schedulingTimeout);
queue_.setExpireTimeout(expireTimeout);
}
void AudioRtpSession::setDestinationIpAddress()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment