详细描述
RTP/RTCP API在SDK API插件包中,可以用来在手机间发送不同的数据类型。Real-time Transport Protocal(RTP)用来发送或接收数据,而RTP control Protocol(RTCP)提供了out-of-band统计以及对RTP流的控制信息。
这篇文章演示了如何打开RTCP,并注册一个Observer获得RTP session中的Receiver report(RP)。接收者还要向发送者报告服务质量。其他的RTCP信息如Sender report(SR),Source description(SDES),End of participation(BYE)以及Application-specific message(APP)可以用来交换RTCP信息。
因为RTCP streaming被用在RTP流中,更多信息关于启动RTP session的信息在下列链接:
http://wiki.forum.nokia.com/index.php/S60_RTP/RTC_API
解决方案
头文件:
Header Files:
#include <rtpapi.h> #include <rtpheader.h> #include <RtpDef.h> |
Link Against:
LIBRARY rtpservice.lib |
Enabling RTCP and registering an observer in an RTP session
iRtpId = iRtpSession->CreateSessionL( sessionParam, localPort, ETrue, //enable RTCP NULL ); //Set default RTCP parameters // Set remote RTCP address TInt err1 = iRtpSession->SetRemoteRtcpAddress(iRtpId, addr2 );<br> //Register for RTCP callback err1 = iRtpSession->RegisterRtcpObserver(iRtpId, *this); |
Sending a Receiver Report(RR) to sender:
iRtpSession->SendRtcpRrPacket(aStreamId); //aStreamId is the TRtpId //of a received RTP packet. |
Receiving the RTCP packet:
void CRTPEngine::RrReceived( TRtpId aStreamId, TRtpSSRC aSSRC ) { //Log the received parameters } |
Unregistering the RTCP callback and closing the session:
iRtpSession->UnregisterRtcpObserver(iRtpId); iRtpSession->CloseSession(iRtpId); |
实例程序
程序使用RTP发送数据包并接收使用RTCP的发送包的回馈。 http://wiki.forum.nokia.com/index.php/File:RTPTest.zip