程序退出时清空RtpProcess对象

This commit is contained in:
xiongziliang 2020-10-24 23:29:44 +08:00
parent fd898254f2
commit c5f1b4cd52
3 changed files with 13 additions and 0 deletions

View File

@ -1155,6 +1155,8 @@ void installWebApi() {
} }
void unInstallWebApi(){ void unInstallWebApi(){
RtpSelector::Instance().clear();
{ {
lock_guard<recursive_mutex> lck(s_proxyMapMtx); lock_guard<recursive_mutex> lck(s_proxyMapMtx);
s_proxyMap.clear(); s_proxyMap.clear();
@ -1164,6 +1166,7 @@ void unInstallWebApi(){
lock_guard<recursive_mutex> lck(s_ffmpegMapMtx); lock_guard<recursive_mutex> lck(s_ffmpegMapMtx);
s_ffmpegMap.clear(); s_ffmpegMap.clear();
} }
{ {
#if defined(ENABLE_RTPPROXY) #if defined(ENABLE_RTPPROXY)
lock_guard<recursive_mutex> lck(s_rtpServerMapMtx); lock_guard<recursive_mutex> lck(s_rtpServerMapMtx);

View File

@ -15,6 +15,11 @@ namespace mediakit{
INSTANCE_IMP(RtpSelector); INSTANCE_IMP(RtpSelector);
void RtpSelector::clear(){
lock_guard<decltype(_mtx_map)> lck(_mtx_map);
_map_rtp_process.clear();
}
bool RtpSelector::inputRtp(const Socket::Ptr &sock, const char *data, int data_len, bool RtpSelector::inputRtp(const Socket::Ptr &sock, const char *data, int data_len,
const struct sockaddr *addr,uint32_t *dts_out) { const struct sockaddr *addr,uint32_t *dts_out) {
//使用ssrc为流id //使用ssrc为流id

View File

@ -55,6 +55,11 @@ public:
static bool getSSRC(const char *data,int data_len, uint32_t &ssrc); static bool getSSRC(const char *data,int data_len, uint32_t &ssrc);
static RtpSelector &Instance(); static RtpSelector &Instance();
/**
*
*/
void clear();
/** /**
* rtp流ssrc分流 * rtp流ssrc分流
* @param sock socket * @param sock socket