Symbian 使用 RTP 发送数据的流程
2010-03-22 16:25:00 来源:WEB开发网User::WaitForRequest(stat);
User::LeaveIfError(stat.Int());
iRtpSession.OpenL(iSocket, aPacketSize+12, iRtcpSocket);
5. 后边有一个没查出功能的
iRtpSession.SetRTPTimeConversion(100, 100);
6. 注册RTP回调
iRtpSession.PrivRegisterEventCallbackL(ERtpNewSource, (TRtpCallbackFunction)CRtpFileStreamer::NewSource, this);
在此处注册后就可以处理收到的信息,处理接口如下:
void CRtpFileStreamer::NewSource(CRtpFileStreamer* aPtr, const TRtpEvent& aEvent)
{
if (aPtr->ReceiveSrc().IsOpen())
{
aPtr->ReceiveSrc().Close();
}
TRAPD(err,
aPtr->ReceiveSrc() = aEvent.Session().NewReceiveSourceL();
aPtr->ReceiveSrc().PrivRegisterEventCallbackL(ERtpPacketReceived, (TRtpCallbackFunction)CRtpFileStreamer::PacketArrived, aPtr);)
if (err!=KErrNone)
{
__DEBUGGER();
}
}
/**
A callback method that is called on packet arrival.
*/
void CRtpFileStreamer::PacketArrived(CRtpFileStreamer* aPtr, const TRtpEvent& aEvent)
{
aPtr->iRecvPacket.Close();
aPtr->iRecvPacket = aEvent.ReceiveSource().Packet();
if (aEvent.ReceiveSource().Packet().IsOpen())
{
__DEBUGGER();
}
TRAPD(err,aPtr->HandleReceivedPacketL());
if (err!=KErrNone)
{
__DEBUGGER();
}
}
7. 现在需要创建一个RRtpSendPacket
RRtpSession& iSession;
RRtpSendSource iSendSrc;
RRtpSendPacket iSendPacket;
iSendSrc = iSession.NewSendSourceL();
iSendSrc.SetDefaultPayloadSize(iPacketSize);
iSendSrc.PrivRegisterEventCallbackL(ERtpSendSucceeded, (TRtpCallbackFunction)CRtpFileSender::PacketSent, this);
更多精彩
赞助商链接