Move SdpContainer used in recon to resipmedia library for use in other projects

This commit is contained in:
Scott Godin
2026-01-08 16:29:54 -05:00
parent 59a66f57a2
commit 09b187e75a
18 changed files with 31 additions and 23 deletions

View File

@@ -9,10 +9,22 @@ add_subdirectory(samples)
set(INCLUDES
RTPPortManager.hxx
sdpcontainer/Sdp.hxx
sdpcontainer/SdpCandidate.hxx
sdpcontainer/SdpCandidatePair.hxx
sdpcontainer/SdpCodec.hxx
sdpcontainer/SdpHelper.hxx
sdpcontainer/SdpMediaLine.hxx
)
add_library(resipmedia
RTPPortManager.cxx
sdpcontainer/Sdp.cxx
sdpcontainer/SdpCandidate.cxx
sdpcontainer/SdpCandidatePair.cxx
sdpcontainer/SdpCodec.cxx
sdpcontainer/SdpHelper.cxx
sdpcontainer/SdpMediaLine.cxx
${INCLUDES}
)

View File

@@ -9,14 +9,19 @@ using namespace std;
#define RESIPROCATE_SUBSYSTEM resip::Subsystem::MEDIA
// We are only handing out even RTP ports; the next higher odd port is used for RTCP
RTPPortManager::RTPPortManager(int portRangeMin, int portRangeMax)
: mPortRangeMin(portRangeMin),
mPortRangeMax(portRangeMax)
mPortRangeMax(portRangeMax),
mTotalPortPairs(0) // set below
{
// Ensure we start on an even port
if(mPortRangeMin & 0x1)
{
mPortRangeMin++;
}
// Ensure we end on an even port, even though mPortMax+1
// is considered valid for RTCP stream of mPortMax port
if(mPortRangeMax & 0x1)
{
mPortRangeMax--;
@@ -27,7 +32,8 @@ RTPPortManager::RTPPortManager(int portRangeMin, int portRangeMax)
mRTPPortFreeList.push_back(i);
i=i+2; // only add even ports
}
InfoLog(<<"RTPPortManager: min == " << mPortRangeMin << " max == " << mPortRangeMax);
mTotalPortPairs = mRTPPortFreeList.size();
StackLog(<< "RTPPortManager: min even port=" << mPortRangeMin << ", max even port=" << mPortRangeMax);
}
unsigned int
@@ -55,8 +61,8 @@ RTPPortManager::freeRTPPort(unsigned int port)
/* ====================================================================
Copyright 2014 Daniel Pocock http://danielpocock.com
Copyright (c) 2010-2025, SIP Spectrum, Inc. http://www.sipspectrum.com
Copyright (c) 2014 Daniel Pocock http://danielpocock.com
Copyright (c) 2007-2008, Plantronics, Inc.
All rights reserved.

View File

@@ -15,11 +15,13 @@ public:
RTPPortManager(int portRangeMin = 17000, int portRangeMax = 18000);
unsigned int allocateRTPPort();
void freeRTPPort(unsigned int port);
unsigned int getNumAllocatedPortPairs() { return mTotalPortPairs - mRTPPortFreeList.size(); }
private:
unsigned int mPortRangeMin;
unsigned int mPortRangeMax;
std::deque<unsigned int> mRTPPortFreeList;
unsigned int mTotalPortPairs;
};
}
@@ -28,8 +30,8 @@ private:
/* ====================================================================
Copyright 2014 Daniel Pocock http://danielpocock.com
Copyright (c) 2010-2026, SIP Spectrum, Inc. http://www.sipspectrum.com
Copyright (c) 2014 Daniel Pocock http://danielpocock.com
Copyright (c) 2007-2008, Plantronics, Inc.
All rights reserved.

View File

@@ -1,7 +1,7 @@
#include <map>
#include <utility>
#include "SdpHelperResip.hxx"
#include "SdpHelper.hxx"
#include "Sdp.hxx"
#include "SdpMediaLine.hxx"
#include "SdpCodec.hxx"

View File

@@ -33,12 +33,6 @@ set(INCLUDES
ConversationProfile.hxx
ConversationManager.hxx
DtmfEvent.hxx
sdp/SdpMediaLine.hxx
sdp/SdpCodec.hxx
sdp/SdpHelperResip.hxx
sdp/SdpCandidatePair.hxx
sdp/SdpCandidate.hxx
sdp/Sdp.hxx
SipXMediaStackAdapter.hxx
SipXMediaInterface.hxx
SipXConversation.hxx
@@ -114,12 +108,6 @@ target_add_conditional_sources(recon USE_SIPXTAPI
SipXRemoteParticipant.cxx
SipXRemoteParticipantDialogSet.cxx
SipXHelper.cxx
sdp/Sdp.cxx
sdp/SdpCandidate.cxx
sdp/SdpCandidatePair.cxx
sdp/SdpCodec.cxx
sdp/SdpHelperResip.cxx
sdp/SdpMediaLine.cxx
)
target_add_conditional_sources(recon USE_KURENTO

View File

@@ -4,8 +4,8 @@
#include "SipXMediaStackAdapter.hxx"
#include "sdp/SdpHelperResip.hxx"
#include "sdp/Sdp.hxx"
#include <media/sdpcontainer/SdpHelper.hxx>
#include <media/sdpcontainer/Sdp.hxx>
#include <sdp/SdpCodec.h> // sipX SdpCodec

View File

@@ -23,8 +23,8 @@
#include "reflow/Flow.hxx"
#include "reflow/MediaStream.hxx"
#include "sdp/SdpHelperResip.hxx"
#include "sdp/Sdp.hxx"
#include <media/sdpcontainer/SdpHelper.hxx>
#include <media/sdpcontainer/Sdp.hxx>
#include <rutil/Log.hxx>
#include <rutil/Logger.hxx>