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 <IRtpSession.h>
18 #include <RtpService.h>
19 #include <ImsMediaTrace.h>
20 #include <ImsMediaVideoUtil.h>
21
22 std::list<IRtpSession*> IRtpSession::mListRtpSession;
23
GetInstance(ImsMediaType type,const RtpAddress & localAddress,const RtpAddress & peerAddress)24 IRtpSession* IRtpSession::GetInstance(
25 ImsMediaType type, const RtpAddress& localAddress, const RtpAddress& peerAddress)
26 {
27 IMLOGD1("[GetInstance] media[%d]", type);
28
29 for (auto& i : mListRtpSession)
30 {
31 if (i != nullptr && i->isSameInstance(type, localAddress, peerAddress))
32 {
33 i->increaseRefCounter();
34 return i;
35 }
36 }
37
38 if (mListRtpSession.size() == 0)
39 {
40 IMLOGI0("[GetInstance] Initialize Rtp Stack");
41 IMS_RtpSvc_Initialize();
42 }
43
44 IRtpSession* pSession = new IRtpSession(type, localAddress, peerAddress);
45 mListRtpSession.push_back(pSession);
46 pSession->increaseRefCounter();
47 return pSession;
48 }
49
ReleaseInstance(IRtpSession * session)50 void IRtpSession::ReleaseInstance(IRtpSession* session)
51 {
52 if (session == nullptr)
53 {
54 return;
55 }
56
57 IMLOGD2("[ReleaseInstance] media[%d], RefCount[%d]", session->getMediaType(),
58 session->getRefCounter());
59 session->decreaseRefCounter();
60
61 if (session->getRefCounter() == 0)
62 {
63 mListRtpSession.remove(session);
64 delete session;
65 }
66
67 if (mListRtpSession.size() == 0)
68 {
69 IMLOGI0("[ReleaseInstance] Deinitialize Rtp Stack");
70 IMS_RtpSvc_Deinitialize();
71 }
72 }
73
IRtpSession(ImsMediaType mediatype,const RtpAddress & localAddress,const RtpAddress & peerAddress)74 IRtpSession::IRtpSession(
75 ImsMediaType mediatype, const RtpAddress& localAddress, const RtpAddress& peerAddress)
76 {
77 mMediaType = mediatype;
78 mRtpSessionId = 0;
79 mRefCount = 0;
80 mLocalAddress = localAddress;
81 mPeerAddress = peerAddress;
82 mRtpEncoderListener = nullptr;
83 mRtpDecoderListener = nullptr;
84 mRtcpEncoderListener = nullptr;
85 mRtcpDecoderListener = nullptr;
86 std::memset(mPayloadParam, 0, sizeof(tRtpSvc_SetPayloadParam) * RTP_MAX_PAYLOAD_TYPE);
87 mNumPayloadParam = 0;
88 mLocalRtpSsrc = 0;
89 mPeerRtpSsrc = 0;
90 mEnableRtcpTx = false;
91 mEnableDTMF = false;
92 mRtpDtmfPayloadType = 0;
93 mPrevTimestamp = -1;
94 mRtpStarted = 0;
95 mRtcpStarted = 0;
96 mNumRtpProcPacket = 0;
97 mNumRtcpProcPacket = 0;
98 mNumRtpPacket = 0;
99 mNumSRPacket = 0;
100 mNumRRPacket = 0;
101 mNumRtpDataToSend = 0;
102 mNumRtpPacketSent = 0;
103 mNumRtcpPacketSent = 0;
104 mRttd = -1;
105
106 // create rtp stack session
107 IMS_RtpSvc_CreateSession(
108 mLocalAddress.ipAddress, mLocalAddress.port, this, &mLocalRtpSsrc, &mRtpSessionId);
109 IMLOGD6("[IRtpSession] media[%d], localIp[%s], localPort[%d], peerIp[%s], peerPort[%d], "
110 "sessionId[%d]",
111 mMediaType, mLocalAddress.ipAddress, mLocalAddress.port, mPeerAddress.ipAddress,
112 mPeerAddress.port, mRtpSessionId);
113 }
114
~IRtpSession()115 IRtpSession::~IRtpSession()
116 {
117 IMS_RtpSvc_DeleteSession(mRtpSessionId);
118 mRtpEncoderListener = nullptr;
119 mRtpDecoderListener = nullptr;
120 mRtcpEncoderListener = nullptr;
121 mRtcpDecoderListener = nullptr;
122 }
123
operator ==(const IRtpSession & obj2)124 bool IRtpSession::operator==(const IRtpSession& obj2)
125 {
126 if (mMediaType == obj2.mMediaType && mLocalAddress == obj2.mLocalAddress &&
127 mPeerAddress == obj2.mPeerAddress)
128 {
129 return true;
130 }
131
132 return false;
133 }
134
isSameInstance(ImsMediaType mediatype,const RtpAddress & localAddress,const RtpAddress & peerAddress)135 bool IRtpSession::isSameInstance(
136 ImsMediaType mediatype, const RtpAddress& localAddress, const RtpAddress& peerAddress)
137 {
138 if (mMediaType == mediatype && mLocalAddress == localAddress && mPeerAddress == peerAddress)
139 {
140 return true;
141 }
142
143 return false;
144 }
145
SetRtpEncoderListener(IRtpEncoderListener * pRtpEncoderListener)146 void IRtpSession::SetRtpEncoderListener(IRtpEncoderListener* pRtpEncoderListener)
147 {
148 std::lock_guard<std::mutex> guard(mutexEncoder);
149 mRtpEncoderListener = pRtpEncoderListener;
150 }
151
SetRtpDecoderListener(IRtpDecoderListener * pRtpDecoderListener)152 void IRtpSession::SetRtpDecoderListener(IRtpDecoderListener* pRtpDecoderListener)
153 {
154 std::lock_guard<std::mutex> guard(mutexDecoder);
155 mRtpDecoderListener = pRtpDecoderListener;
156 }
157
SetRtcpEncoderListener(IRtcpEncoderListener * pRtcpEncoderListener)158 void IRtpSession::SetRtcpEncoderListener(IRtcpEncoderListener* pRtcpEncoderListener)
159 {
160 std::lock_guard<std::mutex> guard(mutexEncoder);
161 mRtcpEncoderListener = pRtcpEncoderListener;
162 }
163
SetRtcpDecoderListener(IRtcpDecoderListener * pRtcpDecoderListener)164 void IRtpSession::SetRtcpDecoderListener(IRtcpDecoderListener* pRtcpDecoderListener)
165 {
166 std::lock_guard<std::mutex> guard(mutexDecoder);
167 mRtcpDecoderListener = pRtcpDecoderListener;
168 }
169
addPayloadType(RtpDt_UInt32 payloadType,RtpDt_UInt32 samplingRate)170 void IRtpSession::addPayloadType(RtpDt_UInt32 payloadType, RtpDt_UInt32 samplingRate)
171 {
172 if (mNumPayloadParam >= RTP_MAX_PAYLOAD_TYPE)
173 {
174 IMLOGE1("[SetRtpPayloadParam] overflow[%d]", mNumPayloadParam);
175 return;
176 }
177
178 mPayloadParam[mNumPayloadParam].payloadType = payloadType;
179 mPayloadParam[mNumPayloadParam].samplingRate = samplingRate;
180 mNumPayloadParam++;
181 }
182
SetRtpPayloadParam(int32_t payloadNumTx,int32_t payloadNumRx,int32_t samplingRate,int32_t subTxPayloadTypeNum,int32_t subRxPayloadTypeNum,int32_t subSamplingRate)183 void IRtpSession::SetRtpPayloadParam(int32_t payloadNumTx, int32_t payloadNumRx,
184 int32_t samplingRate, int32_t subTxPayloadTypeNum, int32_t subRxPayloadTypeNum,
185 int32_t subSamplingRate)
186 {
187 mNumPayloadParam = 0;
188 std::memset(mPayloadParam, 0, sizeof(tRtpSvc_SetPayloadParam) * RTP_MAX_PAYLOAD_TYPE);
189 IMLOGD3("[SetRtpPayloadParam] localPayload[%d], peerPayload[%d], sampling[%d]", payloadNumTx,
190 payloadNumRx, samplingRate);
191
192 addPayloadType(payloadNumTx, samplingRate);
193
194 if (payloadNumTx != payloadNumRx)
195 {
196 // rx parameter
197 addPayloadType(payloadNumRx, samplingRate);
198 }
199
200 if (mMediaType == IMS_MEDIA_AUDIO || mMediaType == IMS_MEDIA_TEXT)
201 {
202 mEnableDTMF = false;
203
204 if (subTxPayloadTypeNum != 0 && subRxPayloadTypeNum != 0)
205 {
206 IMLOGD3("[SetRtpPayloadParam] sub Txpayload[%d],sub Rxpayload[%d],sub samplingRate[%d]",
207 subTxPayloadTypeNum, subRxPayloadTypeNum, subSamplingRate);
208
209 if (mMediaType == IMS_MEDIA_AUDIO)
210 {
211 mEnableDTMF = true;
212 }
213
214 addPayloadType(subTxPayloadTypeNum, subSamplingRate);
215
216 if (subTxPayloadTypeNum != subRxPayloadTypeNum)
217 {
218 addPayloadType(subRxPayloadTypeNum, subSamplingRate);
219 }
220 }
221 }
222
223 IMS_RtpSvc_SetPayload(mRtpSessionId, mPayloadParam,
224 mMediaType == IMS_MEDIA_VIDEO ? eRTP_TRUE : eRTP_FALSE, mNumPayloadParam);
225 }
226
SetRtcpInterval(int32_t nInterval)227 void IRtpSession::SetRtcpInterval(int32_t nInterval)
228 {
229 IMLOGD1("[SetRtcpInterval] nInterval[%d]", nInterval);
230 IMS_RtpSvc_SetRTCPInterval(mRtpSessionId, nInterval);
231 }
232
StartRtp(bool bResetSsrc)233 void IRtpSession::StartRtp(bool bResetSsrc)
234 {
235 IMLOGD1("[StartRtp] RtpStarted[%d]", mRtpStarted);
236
237 if (mRtpStarted == 0)
238 {
239 IMLOGD0("[StartRtp] IMS_RtpSvc_SessionEnableRTP");
240 IMS_RtpSvc_SessionEnableRTP(mRtpSessionId, bResetSsrc ? eRTP_TRUE : eRTP_FALSE);
241 }
242
243 mRtpStarted++;
244 }
245
StopRtp()246 void IRtpSession::StopRtp()
247 {
248 IMLOGD1("[StopRtp] RtpStarted[%d]", mRtpStarted);
249
250 if (mRtpStarted == 0)
251 {
252 return;
253 }
254
255 mRtpStarted--;
256
257 if (mRtpStarted == 0)
258 {
259 IMS_RtpSvc_SessionDisableRTP(mRtpSessionId);
260 IMLOGI0("[StopRtp] IMS_RtpSvc_SessionDisableRTP");
261 }
262 }
263
StartRtcp(bool bSendRtcpBye)264 void IRtpSession::StartRtcp(bool bSendRtcpBye)
265 {
266 IMLOGD1("[StartRtcp] RtcpStarted[%d]", mRtcpStarted);
267
268 if (mRtcpStarted == 0)
269 {
270 IMS_RtpSvc_SessionEnableRTCP(mRtpSessionId, static_cast<eRtp_Bool>(bSendRtcpBye));
271 }
272
273 mEnableRtcpTx = true;
274 mRtcpStarted++;
275 }
276
StopRtcp()277 void IRtpSession::StopRtcp()
278 {
279 IMLOGD1("[StopRtcp] RtcpStarted[%d]", mRtcpStarted);
280
281 if (mRtcpStarted == 0)
282 {
283 return;
284 }
285
286 mRtcpStarted--;
287
288 if (mRtcpStarted == 0)
289 {
290 IMLOGI0("[StopRtcp] IMS_RtpSvc_SessionDisableRtcp");
291 IMS_RtpSvc_SessionDisableRTCP(mRtpSessionId);
292 mEnableRtcpTx = false;
293 }
294 }
295
SendRtpPacket(uint32_t payloadType,uint8_t * data,uint32_t dataSize,uint32_t timestamp,bool mark,uint32_t timeDiff,RtpHeaderExtensionInfo * extensionInfo)296 bool IRtpSession::SendRtpPacket(uint32_t payloadType, uint8_t* data, uint32_t dataSize,
297 uint32_t timestamp, bool mark, uint32_t timeDiff, RtpHeaderExtensionInfo* extensionInfo)
298 {
299 tRtpSvc_SendRtpPacketParam stRtpPacketParam;
300 memset(&stRtpPacketParam, 0, sizeof(tRtpSvc_SendRtpPacketParam));
301 IMLOGD_PACKET5(IM_PACKET_LOG_RTP,
302 "SendRtpPacket, payloadType[%u], size[%u], TS[%u], mark[%d], extension[%d]",
303 payloadType, dataSize, timestamp, mark, extensionInfo != nullptr);
304 stRtpPacketParam.bMbit = mark ? eRTP_TRUE : eRTP_FALSE;
305 stRtpPacketParam.byPayLoadType = payloadType;
306 stRtpPacketParam.diffFromLastRtpTimestamp = timeDiff;
307 stRtpPacketParam.bXbit = extensionInfo != nullptr ? eRTP_TRUE : eRTP_FALSE;
308
309 if (extensionInfo != nullptr)
310 {
311 stRtpPacketParam.wDefinedByProfile = extensionInfo->definedByProfile;
312 stRtpPacketParam.wExtLen = extensionInfo->length;
313 stRtpPacketParam.pExtData = extensionInfo->extensionData;
314 stRtpPacketParam.nExtDataSize = extensionInfo->extensionDataSize;
315 }
316
317 if (mPrevTimestamp == timestamp)
318 {
319 stRtpPacketParam.bUseLastTimestamp = eRTP_TRUE;
320 }
321 else
322 {
323 stRtpPacketParam.bUseLastTimestamp = eRTP_FALSE;
324 mPrevTimestamp = timestamp;
325 }
326
327 mNumRtpDataToSend++;
328 IMS_RtpSvc_SendRtpPacket(
329 this, mRtpSessionId, reinterpret_cast<char*>(data), dataSize, &stRtpPacketParam);
330 return true;
331 }
332
ProcRtpPacket(uint8_t * pData,uint32_t nDataSize)333 bool IRtpSession::ProcRtpPacket(uint8_t* pData, uint32_t nDataSize)
334 {
335 IMLOGD_PACKET1(IM_PACKET_LOG_RTP, "[ProcRtpPacket] size[%d]", nDataSize);
336 mNumRtpProcPacket++;
337
338 /** if it is loopback, change the ssrc */
339 if (mLocalAddress == mPeerAddress)
340 {
341 unsigned int ssrc;
342 ssrc = *reinterpret_cast<uint32_t*>(pData + 8);
343 ssrc++;
344 *reinterpret_cast<uint32_t*>(pData + 8) = ssrc;
345
346 IMLOGD1("[ProcRtcpPacket] loopback mode, ssrc changed[%d]", ssrc);
347 }
348
349 IMS_RtpSvc_ProcRtpPacket(this, mRtpSessionId, pData, nDataSize, mPeerAddress.ipAddress,
350 mPeerAddress.port, mPeerRtpSsrc);
351 return true;
352 }
353
ProcRtcpPacket(uint8_t * pData,uint32_t nDataSize)354 bool IRtpSession::ProcRtcpPacket(uint8_t* pData, uint32_t nDataSize)
355 {
356 IMLOGD_PACKET1(IM_PACKET_LOG_RTCP, "[ProcRtcpPacket] size[%d]", nDataSize);
357 mNumRtcpProcPacket++;
358 IMS_RtpSvc_ProcRtcpPacket(this, mRtpSessionId, pData, nDataSize, mPeerAddress.ipAddress,
359 (mPeerAddress.port + 1), &mLocalRtpSsrc);
360 return true;
361 }
362
OnRtpPacket(unsigned char * pData,RtpSvc_Length wLen)363 int IRtpSession::OnRtpPacket(unsigned char* pData, RtpSvc_Length wLen)
364 {
365 IMLOGD_PACKET1(IM_PACKET_LOG_RTP, "[OnRtpPacket] size[%d]", wLen);
366 std::lock_guard<std::mutex> guard(mutexEncoder);
367
368 if (mRtpEncoderListener)
369 {
370 mNumRtpPacketSent++;
371 mRtpEncoderListener->OnRtpPacket(pData, wLen);
372 return wLen;
373 }
374 return 0;
375 }
376
OnRtcpPacket(unsigned char * pData,RtpSvc_Length wLen)377 int IRtpSession::OnRtcpPacket(unsigned char* pData, RtpSvc_Length wLen)
378 {
379 IMLOGD_PACKET0(IM_PACKET_LOG_RTCP, "[OnRtcpPacket] Enter");
380 if (mEnableRtcpTx == false)
381 {
382 IMLOGD_PACKET0(IM_PACKET_LOG_RTCP, "[OnRtcpPacket] disabled");
383 return wLen;
384 }
385
386 std::lock_guard<std::mutex> guard(mutexEncoder);
387 if (mRtcpEncoderListener)
388 {
389 if (pData != nullptr)
390 {
391 mNumRtcpPacketSent++;
392 mRtcpEncoderListener->OnRtcpPacket(pData, wLen);
393 IMLOGD_PACKET0(IM_PACKET_LOG_RTCP, "[OnRtcpPacket] Send, Exit");
394 return wLen;
395 }
396 else
397 {
398 IMLOGD_PACKET1(IM_PACKET_LOG_RTCP, "[OnRtcpPacket] pData[%x]", pData);
399 return 0;
400 }
401 }
402 return 0;
403 }
404
OnPeerInd(tRtpSvc_IndicationFromStack type,void * pMsg)405 void IRtpSession::OnPeerInd(tRtpSvc_IndicationFromStack type, void* pMsg)
406 {
407 IMLOGD_PACKET2(IM_PACKET_LOG_RTP, "[OnPeerInd] media[%d], type[%d]", mMediaType, type);
408 std::lock_guard<std::mutex> guard(mutexDecoder);
409
410 switch (type)
411 {
412 case RTPSVC_RECEIVE_RTP_IND:
413 mNumRtpPacket++;
414
415 if (mRtpDecoderListener)
416 {
417 tRtpSvcIndSt_ReceiveRtpInd* pstRtp =
418 reinterpret_cast<tRtpSvcIndSt_ReceiveRtpInd*>(pMsg);
419
420 if ((mEnableDTMF == false || mRtpDtmfPayloadType != pstRtp->dwPayloadType) &&
421 pstRtp->dwPayloadType != 20)
422 {
423 RtpHeaderExtensionInfo extensionInfo(pstRtp->wDefinedByProfile, pstRtp->wExtLen,
424 reinterpret_cast<int8_t*>(pstRtp->pExtData), pstRtp->wExtDataSize);
425
426 mRtpDecoderListener->OnMediaDataInd(pstRtp->pMsgBody, pstRtp->wMsgBodyLen,
427 pstRtp->dwTimestamp, pstRtp->bMbit, pstRtp->dwSeqNum,
428 pstRtp->dwPayloadType, pstRtp->dwSsrc, extensionInfo);
429 }
430 }
431 break;
432
433 case RTPSVC_RECEIVE_RTCP_SR_IND:
434 mNumSRPacket++;
435
436 if (mRtcpDecoderListener)
437 {
438 mRtcpDecoderListener->OnRtcpInd(type, pMsg);
439 }
440 break;
441 case RTPSVC_RECEIVE_RTCP_RR_IND:
442 mNumRRPacket++;
443
444 if (mRtcpDecoderListener)
445 {
446 mRtcpDecoderListener->OnRtcpInd(type, pMsg);
447 }
448 break;
449 case RTPSVC_RECEIVE_RTCP_FB_IND:
450 case RTPSVC_RECEIVE_RTCP_PAYLOAD_FB_IND:
451 if (mRtcpDecoderListener)
452 {
453 mRtcpDecoderListener->OnRtcpInd(type, pMsg);
454 }
455 break;
456 default:
457 IMLOGD1("[OnPeerInd] unhandled[%d]", type);
458 break;
459 }
460 }
461
OnPeerRtcpComponents(void * nMsg)462 void IRtpSession::OnPeerRtcpComponents(void* nMsg)
463 {
464 IMLOGD0("[OnPeerRtcpComponents]");
465
466 if (nMsg != nullptr && mRtcpDecoderListener != nullptr)
467 {
468 int32_t roundTripTimeDelay = *reinterpret_cast<int32_t*>(nMsg);
469 mRtcpDecoderListener->OnEvent(kRequestRoundTripTimeDelayUpdate, roundTripTimeDelay);
470 }
471 }
472
OnRtpStatsTimerExpired()473 void IRtpSession::OnRtpStatsTimerExpired()
474 {
475 IMLOGI8("[OnRtpStatsTimerExpired] media[%d], RXRtp[%03d/%03d], RXRtcp[%02d/%02d], "
476 "TXRtp[%03d/%03d], TXRtcp[%02d]",
477 mMediaType, mNumRtpProcPacket, mNumRtpPacket, mNumRtcpProcPacket,
478 mNumSRPacket + mNumRRPacket, mNumRtpDataToSend, mNumRtpPacketSent, mNumRtcpPacketSent);
479
480 std::lock_guard<std::mutex> guard(mutexDecoder);
481
482 if (mRtpDecoderListener)
483 {
484 mRtpDecoderListener->OnNumReceivedPacket(mNumRtpProcPacket);
485 }
486
487 if (mRtcpDecoderListener)
488 {
489 mRtcpDecoderListener->OnNumReceivedPacket(mNumRtcpProcPacket, mNumRRPacket);
490 }
491
492 mNumRtpProcPacket = 0;
493 mNumRtcpProcPacket = 0;
494 mNumRtpPacket = 0;
495 mNumSRPacket = 0;
496 mNumRRPacket = 0;
497 mNumRtpDataToSend = 0;
498 mNumRtpPacketSent = 0;
499 mNumRtcpPacketSent = 0;
500 }
501
SendRtcpXr(uint8_t * pPayload,uint32_t nSize)502 void IRtpSession::SendRtcpXr(uint8_t* pPayload, uint32_t nSize)
503 {
504 IMLOGD1("[SendRtcpXr] nSize[%d]", nSize);
505
506 if (mRtpSessionId)
507 {
508 IMS_RtpSvc_SendRtcpXrPacket(mRtpSessionId, pPayload, nSize);
509 }
510 }
511
SendRtcpFeedback(int32_t type,uint8_t * pFic,uint32_t nFicSize)512 bool IRtpSession::SendRtcpFeedback(int32_t type, uint8_t* pFic, uint32_t nFicSize)
513 {
514 IMLOGD1("[SendRtcpFeedback] type[%d]", type);
515
516 if (!mRtcpStarted)
517 {
518 return false;
519 }
520
521 eRtp_Bool bRet = eRTP_FALSE;
522
523 if (kRtpFbNack <= type && type <= kRtpFbTmmbn)
524 {
525 // RTP-FB
526 IMLOGD1("[SendRtcpFeedback] Send rtp feedback, type[%d]", type);
527 bRet = IMS_RtpSvc_SendRtcpRtpFbPacket(
528 mRtpSessionId, type, reinterpret_cast<char*>(pFic), nFicSize, mPeerRtpSsrc);
529 }
530 else if (kPsfbPli <= type && type <= kPsfbFir)
531 {
532 type -= kPsfbBoundary;
533 // PSFB
534 IMLOGD1("[SendRtcpFeedback] Send payload specific feedback, type[%d]", type);
535 bRet = IMS_RtpSvc_SendRtcpPayloadFbPacket(
536 mRtpSessionId, type, reinterpret_cast<char*>(pFic), nFicSize, mPeerRtpSsrc);
537 }
538
539 if (bRet != eRTP_TRUE)
540 {
541 IMLOGE0("[SendRtcpFeedback] error");
542 return false;
543 }
544
545 return true;
546 }
547
getMediaType()548 ImsMediaType IRtpSession::getMediaType()
549 {
550 return mMediaType;
551 }
552
increaseRefCounter()553 void IRtpSession::increaseRefCounter()
554 {
555 ++mRefCount;
556 IMLOGD1("[increaseRefCounter] count[%d]", mRefCount.load());
557 }
558
decreaseRefCounter()559 void IRtpSession::decreaseRefCounter()
560 {
561 --mRefCount;
562 IMLOGD1("[decreaseRefCounter] count[%d]", mRefCount.load());
563 }
564
getRefCounter()565 uint32_t IRtpSession::getRefCounter()
566 {
567 return mRefCount.load();
568 }
569
SetRtpContext(uint32_t ssrc,uint32_t timestamp,uint16_t sequenceNumber)570 void IRtpSession::SetRtpContext(uint32_t ssrc, uint32_t timestamp, uint16_t sequenceNumber)
571 {
572 IMS_RtpSvc_SetRtpContext(mRtpSessionId, ssrc, timestamp, sequenceNumber);
573 }
574
GetRtpContext(uint32_t & ssrc,uint32_t & timestamp,uint16_t & sequenceNumber)575 void IRtpSession::GetRtpContext(uint32_t& ssrc, uint32_t& timestamp, uint16_t& sequenceNumber)
576 {
577 IMS_RtpSvc_GetRtpContext(mRtpSessionId, ssrc, timestamp, sequenceNumber);
578 }
579