Commit 9e304321 authored by Rafaël Carré's avatar Rafaël Carré

AudioRtpSession::updateSessionMedia() : simplify

parent ddb8ffce
......@@ -87,21 +87,6 @@ void AudioRtpRecordHandler::setRtpMedia (AudioCodec* audioCodec)
_audioRtpRecord.audioCodecMutex.leave();
}
void AudioRtpRecordHandler::updateRtpMedia (AudioCodec *audioCodec)
{
int lastSamplingRate = _audioRtpRecord._codecSampleRate;
setRtpMedia(audioCodec);
Manager::instance().audioSamplingRateChanged(_audioRtpRecord._codecSampleRate);
if (lastSamplingRate != _audioRtpRecord._codecSampleRate) {
_debug ("AudioRtpSession: Update noise suppressor with sampling rate %d and frame size %d", getCodecSampleRate(), getCodecFrameSize());
initNoiseSuppress();
}
}
void AudioRtpRecordHandler::initBuffers()
{
// Set sampling rate, main buffer choose the highest one
......
......@@ -125,9 +125,6 @@ class AudioRtpRecordHandler
void setRtpMedia (AudioCodec* audioCodec);
void updateRtpMedia (AudioCodec *audioCodec);
AudioCodec *getAudioCodec (void) const {
return _audioRtpRecord._audioCodec;
}
......
......@@ -39,6 +39,7 @@
#include "audio/audiolayer.h"
#include <ccrtp/rtp.h>
#include <ccrtp/oqueue.h>
#include "manager.h"
namespace sfl
{
......@@ -68,42 +69,17 @@ void AudioRtpSession::updateSessionMedia (AudioCodec *audioCodec)
_debug ("AudioSymmetricRtpSession: Update session media");
// Update internal codec for this session
updateRtpMedia (audioCodec);
int lastSamplingRate = _audioRtpRecord._codecSampleRate;
// 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;
setSessionMedia(audioCodec);
_debug ("AudioRptSession: Codec payload: %d", payloadType);
_debug ("AudioSymmetricRtpSession: Codec sampling rate: %d", smplRate);
_debug ("AudioSymmetricRtpSession: Codec frame size: %d", frameSize);
_debug ("AudioSymmetricRtpSession: RTP timestamp increment: %d", _timestampIncrement);
Manager::instance().audioSamplingRateChanged(_audioRtpRecord._codecSampleRate);
if (payloadType == g722PayloadType) {
_debug ("AudioSymmetricRtpSession: Setting G722 payload format");
_queue->setPayloadFormat (ost::DynamicPayloadFormat ( (ost::PayloadType) payloadType, g722RtpClockRate));
} else {
if (dynamic) {
_debug ("AudioSymmetricRtpSession: Setting dynamic payload format");
_queue->setPayloadFormat (ost::DynamicPayloadFormat ( (ost::PayloadType) payloadType, smplRate));
} else {
_debug ("AudioSymmetricRtpSession: Setting static payload format");
_queue->setPayloadFormat (ost::StaticPayloadFormat ( (ost::StaticPayloadType) payloadType));
}
if (lastSamplingRate != _audioRtpRecord._codecSampleRate) {
_debug ("AudioRtpSession: Update noise suppressor with sampling rate %d and frame size %d", getCodecSampleRate(), getCodecFrameSize());
initNoiseSuppress();
}
if (_type != Zrtp) {
_ca->setRecordingSmplRate (getCodecSampleRate());
_timestamp = _queue->getCurrentTimestamp();
}
}
void AudioRtpSession::setSessionMedia (AudioCodec *audioCodec)
......
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