使用RTP/RTCP API来发送数据

详细描述
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  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值