- always use (and depend on) resiprocate

This commit is contained in:
Dmytro Bogovych 2025-09-24 10:59:24 +03:00
parent 6df835bb95
commit 1599bfc9fc
10 changed files with 11 additions and 64 deletions

View File

@ -99,7 +99,6 @@ void AudioProvider::updateSdpOffer(resip::SdpContents::Session::Medium& sdp, Sdp
else
sdp.addAttribute("crypto", resip::Data(createCryptoAttribute(mSrtpSuite)));
}
#if defined(USE_RESIP_INTEGRATION)
// Use CodecListPriority mCodecPriority adapter to work with codec priorities
if (mAvailableCodecs.empty())
@ -114,7 +113,7 @@ void AudioProvider::updateSdpOffer(resip::SdpContents::Session::Medium& sdp, Sdp
if (mRemoteTelephoneCodec)
sdp.addCodec(resip::SdpContents::Session::Codec::TelephoneEvent);
}
#endif
// Publish stream state
const char* attr = nullptr;
@ -229,10 +228,8 @@ bool AudioProvider::processSdpOffer(const resip::SdpContents::Session::Medium& m
for (int localIndex=0; localIndex<mCodecPriority.count(mTerminal.codeclist()); localIndex++)
{
MT::Codec::Factory& factory = mCodecPriority.codecAt(mTerminal.codeclist(), localIndex);
#if defined(USE_RESIP_INTEGRATION)
if ((pt = factory.processSdp(media.codecs(), sdpDirection)) != -1)
mAvailableCodecs.push_back(RemoteCodec(&factory, pt));
#endif
}
if (!mAvailableCodecs.size())

View File

@ -10,7 +10,6 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
# Produce PIC code always
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
option (USE_RESIP_INTEGRATION "Integrate with resiprocate project" OFF)
set (SOURCES
MT_Statistics.cpp
@ -113,8 +112,4 @@ target_include_directories(media_lib
${CMAKE_CURRENT_SOURCE_DIR}/../../libs/libevs/basic_math
)
if (USE_RESIP_INTEGRATION)
message("USE_RESIP_INTEGRATION is turned on!")
target_compile_definitions(media_lib PUBLIC -DUSE_RESIP_INTEGRATION)
endif()

View File

@ -239,12 +239,9 @@ int AmrNbCodec::CodecFactory::payloadType()
return mConfig.mPayloadType;
}
#ifdef USE_RESIP_INTEGRATION
void AmrNbCodec::CodecFactory::updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{
}
{}
int AmrNbCodec::CodecFactory::processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{
@ -256,7 +253,6 @@ void AmrNbCodec::CodecFactory::create(CodecMap& codecs)
codecs[payloadType()] = std::shared_ptr<Codec>(new AmrNbCodec(mConfig));
}
#endif
PCodec AmrNbCodec::CodecFactory::create()
{
return PCodec(new AmrNbCodec(mConfig));
@ -483,8 +479,6 @@ int AmrWbCodec::CodecFactory::payloadType()
return mConfig.mPayloadType;
}
#ifdef USE_RESIP_INTEGRATION
void AmrWbCodec::CodecFactory::updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{}
@ -498,8 +492,6 @@ void AmrWbCodec::CodecFactory::create(CodecMap& codecs)
codecs[payloadType()] = std::shared_ptr<Codec>(new AmrWbCodec(mConfig));
}
#endif
PCodec AmrWbCodec::CodecFactory::create()
{
return PCodec(new AmrWbCodec(mConfig));
@ -706,8 +698,6 @@ int GsmEfrCodec::GsmEfrFactory::payloadType()
return mPayloadType;
}
#ifdef USE_RESIP_INTEGRATION
void GsmEfrCodec::GsmEfrFactory::updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{
@ -723,8 +713,6 @@ void GsmEfrCodec::GsmEfrFactory::create(CodecMap& codecs)
codecs[payloadType()] = std::shared_ptr<Codec>(new GsmEfrCodec(mIuUP));
}
#endif
PCodec GsmEfrCodec::GsmEfrFactory::create()
{
return PCodec(new GsmEfrCodec(mIuUP));

View File

@ -43,11 +43,10 @@ public:
int samplerate() override;
int payloadType() override;
#ifdef USE_RESIP_INTEGRATION
void updateSdp(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;
#endif
PCodec create() override;
protected:
@ -98,11 +97,10 @@ public:
int samplerate() override;
int payloadType() override;
#ifdef USE_RESIP_INTEGRATION
void updateSdp(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;
#endif
PCodec create() override;
protected:
@ -140,11 +138,10 @@ public:
int samplerate() override;
int payloadType() override;
#ifdef USE_RESIP_INTEGRATION
void updateSdp(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;
#endif
PCodec create() override;
protected:

View File

@ -58,18 +58,14 @@ int G729Codec::G729Factory::payloadType()
return 18;
}
#if defined(USE_RESIP_INTEGRATION)
void G729Codec::G729Factory::updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{
}
{}
int G729Codec::G729Factory::processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{
return 0;
}
#endif
PCodec G729Codec::G729Factory::create()
{
return std::make_shared<G729Codec>();
@ -241,7 +237,6 @@ OpusCodec::Params::Params()
mTargetBitrate = OPUS_TARGET_BITRATE;
}
#if defined(USE_RESIP_INTEGRATION)
resip::Data OpusCodec::Params::toString() const
{
std::ostringstream oss;
@ -324,7 +319,7 @@ void OpusCodec::Params::parse(const resip::Data &params)
mPtime = strx::toInt(paramIter->mValue.c_str(), 20);
}
}
#endif
OpusCodec::OpusFactory::OpusFactory(int samplerate, int channels, int ptype)
{
mSamplerate = samplerate;
@ -352,7 +347,6 @@ int OpusCodec::OpusFactory::payloadType()
return mPType;
}
#if defined(USE_RESIP_INTEGRATION)
void OpusCodec::OpusFactory::updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction)
{
// Put opus codec record
@ -394,7 +388,6 @@ int OpusCodec::OpusFactory::processSdp(const resip::SdpContents::Session::Medium
}
return -1;
}
#endif
PCodec OpusCodec::OpusFactory::create()
{
@ -719,7 +712,6 @@ PCodec IlbcCodec::IlbcFactory::create()
return PCodec(new IlbcCodec(mPtime));
}
#if defined(USE_RESIP_INTEGRATION)
void IlbcCodec::IlbcFactory::create(CodecMap& codecs)
{
codecs[mPType20ms] = PCodec(create());
@ -781,8 +773,6 @@ int IlbcCodec::IlbcFactory::processSdp(const resip::SdpContents::Session::Medium
return pt;
}
#endif
// --- IsacCodec(s) ---
#define ISAC_CODEC_NAME "ISAC"

View File

@ -46,10 +46,9 @@ public:
int samplerate() override;
int payloadType() override;
#if defined(USE_RESIP_INTEGRATION)
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
#endif
PCodec create() override;
};
G729Codec();
@ -82,10 +81,8 @@ public:
int mPtime, mTargetBitrate, mExpectedPacketLoss;
Params();
#if defined(USE_RESIP_INTEGRATION)
resip::Data toString() const;
void parse(const resip::Data& params);
#endif
};
class OpusFactory: public Factory
@ -103,10 +100,8 @@ public:
int channels() override;
int samplerate() override;
int payloadType() override;
#if defined(USE_RESIP_INTEGRATION)
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
#endif
PCodec create() override;
};
@ -146,11 +141,9 @@ public:
const char* name();
int samplerate();
int payloadType();
#if defined(USE_RESIP_INTEGRATION)
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
void create(CodecMap& codecs);
#endif
PCodec create();
};

View File

@ -11,8 +11,6 @@ int Codec::Factory::channels()
{
return 1;
}
#if defined(USE_RESIP_INTEGRATION)
void Codec::Factory::create(CodecMap& codecs)
{
codecs[payloadType()] = std::shared_ptr<Codec>(create());
@ -38,4 +36,4 @@ int Codec::Factory::processSdp(const resip::SdpContents::Session::Medium::CodecC
}
return -1;
}
#endif

View File

@ -6,9 +6,7 @@
#ifndef __MT_CODEC_H
#define __MT_CODEC_H
#if defined(USE_RESIP_INTEGRATION)
#include "resiprocate/resip/stack/SdpContents.hxx"
#endif
#include "../helper/HL_Types.h"
#include <map>
#include "../helper/HL_Pointer.h"
@ -36,14 +34,12 @@ public:
virtual PCodec create() = 0;
virtual int channels();
#if defined(USE_RESIP_INTEGRATION)
typedef std::map<int, PCodec > CodecMap;
virtual void create(CodecMap& codecs);
virtual void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
// Returns payload type from chosen codec if success. -1 is returned for negative result.
virtual int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
resip::Codec resipCodec();
#endif
};
virtual ~Codec() {}
virtual const char* name() = 0;

View File

@ -206,7 +206,6 @@ CodecList::Settings::OpusSpec CodecList::Settings::OpusSpec::parse(const std::st
return result;
}
#if defined(USE_RESIP_INTEGRATION)
static int findOctetMode(const char* line)
{
const char* param_name = "octet-align=";
@ -276,8 +275,6 @@ CodecList::Settings CodecList::Settings::parseSdp(const std::list<resip::Codec>&
}
return r;
}
#endif
bool CodecList::Settings::operator == (const Settings& rhs) const
{

View File

@ -8,9 +8,7 @@
#include "../engine_config.h"
#if defined(USE_RESIP_INTEGRATION)
#include "resiprocate/resip/stack/SdpContents.hxx"
#endif
#include "MT_Codec.h"
#include <vector>
@ -105,9 +103,7 @@ public:
static Settings DefaultSettings;
#if defined(USE_RESIP_INTEGRATION)
static Settings parseSdp(const std::list<resip::Codec>& codeclist);
#endif
bool operator == (const Settings& rhs) const;
};