- fixes
This commit is contained in:
parent
0114b91917
commit
ac17680e9a
|
|
@ -492,8 +492,8 @@ void Session::getSessionInfo(Session::InfoOptions options, VariantMap& info)
|
||||||
info[SessionInfo_AudioPeer] = mIceStack->remoteAddress(media->iceInfo().mStreamId, media->iceInfo().mComponentId.mRtp).toStdString();
|
info[SessionInfo_AudioPeer] = mIceStack->remoteAddress(media->iceInfo().mStreamId, media->iceInfo().mComponentId.mRtp).toStdString();
|
||||||
|
|
||||||
info[SessionInfo_Jitter] = stat.mJitter;
|
info[SessionInfo_Jitter] = stat.mJitter;
|
||||||
if (stat.mRttDelay.isInitialized())
|
if (stat.mRttDelay.is_initialized())
|
||||||
info[SessionInfo_Rtt] = static_cast<float>(stat.mRttDelay.getCurrent() * 1000);
|
info[SessionInfo_Rtt] = static_cast<float>(stat.mRttDelay * 1000);
|
||||||
#if defined(USE_AMR_CODEC)
|
#if defined(USE_AMR_CODEC)
|
||||||
info[SessionInfo_BitrateSwitchCounter] = stat.mBitrateSwitchCounter;
|
info[SessionInfo_BitrateSwitchCounter] = stat.mBitrateSwitchCounter;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
# Produce PIC code always
|
# Produce PIC code always
|
||||||
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
set (USE_RESIP_INTEGRATION CACHE BOOL FALSE "Integrate with resip structures")
|
#set (USE_RESIP_INTEGRATION CACHE BOOL OFF "Integrate with resip structures")
|
||||||
file(GLOB MEDIA_LIB_SOURCES "*.cpp" "*.h")
|
file(GLOB MEDIA_LIB_SOURCES "*.cpp" "*.h")
|
||||||
|
|
||||||
if(CMAKE_SYSTEM MATCHES "Linux*")
|
if(CMAKE_SYSTEM MATCHES "Linux*")
|
||||||
|
|
@ -38,6 +38,7 @@ target_include_directories(media_lib
|
||||||
)
|
)
|
||||||
|
|
||||||
if (USE_RESIP_INTEGRATION)
|
if (USE_RESIP_INTEGRATION)
|
||||||
|
message("USE_RESIP_INTEGRATION is turned on!")
|
||||||
target_compile_definitions(media_lib PUBLIC -DUSE_RESIP_INTEGRATION)
|
target_compile_definitions(media_lib PUBLIC -DUSE_RESIP_INTEGRATION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -646,7 +646,7 @@ PCodec IlbcCodec::IlbcFactory::create()
|
||||||
return PCodec(new IlbcCodec(mPtime));
|
return PCodec(new IlbcCodec(mPtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void IlbcCodec::IlbcFactory::create(CodecMap& codecs)
|
void IlbcCodec::IlbcFactory::create(CodecMap& codecs)
|
||||||
{
|
{
|
||||||
codecs[mPType20ms] = PCodec(create());
|
codecs[mPType20ms] = PCodec(create());
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ namespace MT
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
void create(CodecMap& codecs);
|
void create(CodecMap& codecs);
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ bool AudioReceiver::add(std::shared_ptr<jrtplib::RTPPacket> p, Codec** codec)
|
||||||
|
|
||||||
// Process jitter
|
// Process jitter
|
||||||
mJitterStats.process(p.get(), codecIter->second->samplerate());
|
mJitterStats.process(p.get(), codecIter->second->samplerate());
|
||||||
mStat.mJitter = static_cast<float>(mJitterStats.get().getCurrent());
|
mStat.mJitter = static_cast<float>(mJitterStats.get());
|
||||||
|
|
||||||
// Check if packet is CNG
|
// Check if packet is CNG
|
||||||
if (payloadLength >= 1 && payloadLength <= 6 && (ptype == 0 || ptype == 8))
|
if (payloadLength >= 1 && payloadLength <= 6 && (ptype == 0 || ptype == 8))
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ int Codec::Factory::channels()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void Codec::Factory::create(CodecMap& codecs)
|
void Codec::Factory::create(CodecMap& codecs)
|
||||||
{
|
{
|
||||||
codecs[payloadType()] = std::shared_ptr<Codec>(create());
|
codecs[payloadType()] = std::shared_ptr<Codec>(create());
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef __MT_CODEC_H
|
#ifndef __MT_CODEC_H
|
||||||
#define __MT_CODEC_H
|
#define __MT_CODEC_H
|
||||||
|
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
# include "resiprocate/resip/stack/SdpContents.hxx"
|
# include "resiprocate/resip/stack/SdpContents.hxx"
|
||||||
#endif
|
#endif
|
||||||
#include "../helper/HL_Types.h"
|
#include "../helper/HL_Types.h"
|
||||||
|
|
@ -36,7 +36,7 @@ namespace MT
|
||||||
virtual PCodec create() = 0;
|
virtual PCodec create() = 0;
|
||||||
|
|
||||||
virtual int channels();
|
virtual int channels();
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
typedef std::map<int, PCodec > CodecMap;
|
typedef std::map<int, PCodec > CodecMap;
|
||||||
virtual void create(CodecMap& codecs);
|
virtual void create(CodecMap& codecs);
|
||||||
virtual void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
virtual void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#define __MT_CODEC_LIST_H
|
#define __MT_CODEC_LIST_H
|
||||||
|
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
# include "resiprocate/resip/stack/SdpContents.hxx"
|
# include "resiprocate/resip/stack/SdpContents.hxx"
|
||||||
#endif
|
#endif
|
||||||
#include "MT_Codec.h"
|
#include "MT_Codec.h"
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace MT
|
||||||
int samplerate() override;
|
int samplerate() override;
|
||||||
int payloadType() override;
|
int payloadType() override;
|
||||||
|
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
void create(CodecMap& codecs) override;
|
void create(CodecMap& codecs) override;
|
||||||
|
|
@ -81,7 +81,7 @@ namespace MT
|
||||||
int samplerate() override;
|
int samplerate() override;
|
||||||
int payloadType() override;
|
int payloadType() override;
|
||||||
|
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
void create(CodecMap& codecs) override;
|
void create(CodecMap& codecs) override;
|
||||||
|
|
@ -123,7 +123,7 @@ namespace MT
|
||||||
int samplerate() override;
|
int samplerate() override;
|
||||||
int payloadType() override;
|
int payloadType() override;
|
||||||
|
|
||||||
#ifdef USE_RESIP_INTEGRATION
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
void create(CodecMap& codecs) override;
|
void create(CodecMap& codecs) override;
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,18 @@ struct Average
|
||||||
{
|
{
|
||||||
int mCount = 0;
|
int mCount = 0;
|
||||||
T mSum = 0;
|
T mSum = 0;
|
||||||
T getAverage() const
|
T average() const
|
||||||
{
|
{
|
||||||
if (!mCount)
|
if (!mCount)
|
||||||
return 0;
|
return 0;
|
||||||
return mSum / mCount;
|
return mSum / mCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T value() const
|
||||||
|
{
|
||||||
|
return average();
|
||||||
|
}
|
||||||
|
|
||||||
void process(T value)
|
void process(T value)
|
||||||
{
|
{
|
||||||
mCount++;
|
mCount++;
|
||||||
|
|
@ -32,13 +37,13 @@ struct Average
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, int minimum = 100000, int maximum = 0>
|
template<typename T, int minimum = 100000, int maximum = 0, int default_value = 0>
|
||||||
struct TestResult
|
struct TestResult
|
||||||
{
|
{
|
||||||
T mMin = minimum;
|
T mMin = minimum;
|
||||||
T mMax = maximum;
|
T mMax = maximum;
|
||||||
Average<T> mAverage;
|
Average<T> mAverage;
|
||||||
T mCurrent = minimum;
|
T mCurrent = default_value;
|
||||||
|
|
||||||
void process(T value)
|
void process(T value)
|
||||||
{
|
{
|
||||||
|
|
@ -50,18 +55,34 @@ struct TestResult
|
||||||
mAverage.process(value);
|
mAverage.process(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInitialized() const
|
bool is_initialized() const
|
||||||
{
|
{
|
||||||
return mAverage.mCount > 0;
|
return mAverage.mCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
T getCurrent() const
|
T current() const
|
||||||
{
|
{
|
||||||
if (isInitialized())
|
if (is_initialized())
|
||||||
return mCurrent;
|
return mCurrent;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T value() const
|
||||||
|
{
|
||||||
|
return current();
|
||||||
|
}
|
||||||
|
|
||||||
|
TestResult<T>& operator = (T value)
|
||||||
|
{
|
||||||
|
process(value);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
operator T()
|
||||||
|
{
|
||||||
|
return mCurrent;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue