【Darwin学习笔记】之QTSSReflectorModule的Setup消息处理

8 篇文章 0 订阅
8 篇文章 5 订阅

Setup消息进入到DoSetup函数单独处理,处理流程如下:

【转载请注明出处】:http://blog.csdn.net/longlong530

1. 根据关键字qtssRTSPReqTransportMode判断是否为推模式,具体isPush值由Setup请求中的mode值有关,mode="receive" || mode="record"表示isPush为true。对应的解析函数为:void RTSPRequest::ParseModeSubHeader(StrPtrLen* inModeSubHeader)

StrPtrLen theMode;
theSubHeaderParser.ConsumeWord(&theMode);
//mode="receive" || mode="record"表示isPush为true,即为推模式。
if ( theMode.EqualIgnoreCase(sReceiveMode) || theMode.EqualIgnoreCase(sRecordMode) )
{	
    fTransportMode = qtssRTPTransportModeRecord;
    break;
}

2. 查询是否已经建立RTPSessionOutput。

1.1)    如果没有,且是从UI发来的标准RTSP客户端请求,那么

//增加客户端输出管道(多路转发);
 RTPSessionOutput* theNewOutput = NEW RTPSessionOutput(inParams->inClientSession, theSession, sServerPrefs, sStreamCookieAttr );
 theSession->AddOutput(theNewOutput,true);
 //将新建的RTPSessionOutput存储起来,key = sOutputAttr;
 (void)QTSS_SetValue(inParams->inClientSession, sOutputAttr, 0, &theNewOutput, sizeof(theNewOutput));
1.2)   如果isPush = true,代表为Announce推流中的SETUP消息,那么

/*
根据前面Announce中存储于qtssRTSPReqLocalPath的路径读取sdp信息,调用DoSessionSetup创建或引用已存在的ReflectorSession<span style="font-family: Arial, Helvetica, sans-serif;">转发会话</span><span style="font-family: Arial, Helvetica, sans-serif;"> </span>
*/
 theSession = DoSessionSetup(inParams, qtssRTSPReqFilePathTrunc,isPush,&foundSession);

2) 如果已经存在输出会话,即直接调用。


3. 解析track ID,后面会根据这个track id来获取流信息

 char* theDigitStr = NULL;
(void)QTSS_GetValueAsString(inParams->inRTSPRequest, qtssRTSPReqFileDigit, 0, &theDigitStr);
 QTSSCharArrayDeleter theDigitStrDeleter(theDigitStr);

4. 如果是推流模式:

//标识流转发的建立
        theStreamInfo->fSetupToReceive = true;
        // This is an incoming data session. Set the Reflector Session in the ClientSession
		//设置转发会话的RTPSession字典的sClientBroadcastSessionAttr字段
        theErr = QTSS_SetValue(inParams->inClientSession, sClientBroadcastSessionAttr, 0, &theSession, sizeof(theSession));
        Assert(theErr == QTSS_NoErr);
        //设置ReflectorSession的fBroadcasterSession属性为inParams->inClientSession
        if (theSession != NULL)
            theSession->AddBroadcasterClientSession(inParams);

【转载请注明出处】:http://blog.csdn.net/longlong530




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值