1 /** 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <RtpSessionManager.h> 18 19 RtpSessionManager* RtpSessionManager::m_pInstance = nullptr; 20 RtpSessionManager()21RtpSessionManager::RtpSessionManager() : 22 m_objActiveSessionList(std::list<RtpDt_Void*>()) 23 { 24 } 25 ~RtpSessionManager()26RtpSessionManager::~RtpSessionManager() {} 27 getInstance()28RtpSessionManager* RtpSessionManager::getInstance() 29 { 30 if (m_pInstance == nullptr) 31 { 32 m_pInstance = new RtpSessionManager(); 33 } 34 return m_pInstance; 35 } 36 addRtpSession(IN RtpDt_Void * pvData)37RtpDt_Void RtpSessionManager::addRtpSession(IN RtpDt_Void* pvData) 38 { 39 m_objActiveSessionList.push_back(pvData); 40 return; 41 } 42 removeRtpSession(IN RtpDt_Void * pvData)43RtpDt_Void RtpSessionManager::removeRtpSession(IN RtpDt_Void* pvData) 44 { 45 m_objActiveSessionList.remove(pvData); 46 return; 47 } 48 isValidRtpSession(IN RtpDt_Void * pvData)49eRtp_Bool RtpSessionManager::isValidRtpSession(IN RtpDt_Void* pvData) 50 { 51 for (const auto& pobjActiveSession : m_objActiveSessionList) 52 { 53 if (pobjActiveSession == nullptr) 54 { 55 return eRTP_FALSE; 56 } 57 58 if (pobjActiveSession == pvData) 59 { 60 return eRTP_TRUE; 61 } 62 } 63 64 return eRTP_FALSE; 65 } 66