最近在做项目的过程中遇到一个问题,在用DarwinStreamingServer中的QTSSReflectorModule模块做为流转发和分发服务,用live555的DarwinInjector类做为模拟设备进行流推送时,如果按照正常RTSP推送流程:Announce、Setup、Play…、Teardown,Darwin能较好地完成流的转发,但是假如设备在不正常工作,例如网络异常断开,设备断电等中断了数据流的推送,而缺少了服务器>的Teardown过程,这样与此路推送相关的RTSPSession、RTPSession以及ReflectorSession等都需要等到配置的“rtp_timeout”时间后、RTPSession超时才能析构所有相关转发对象
先分析下原因:RTSPSession在创建RTPSession时[cpp]viewplaincopyprint
//SetthecurrentRTSPsessionforthisRTPsession
//WedothisherebecauseweneedtomakesuretheSessionMutex3
//isgrabbedwhilewedothis
OnlydothisiftheRTSPsession4
//isstillalive,ofcourse
if(this->IsLiveSession())6
fRTPSession->UpdateRTSPSession(this);[cpp]viewplaincopyprint
voidRTPSessionInterface::UpdateRTSPSession(RTSPSessionInterface*inNewRTSPSession)2
if(inNewRTSPSession
=fRTSPSession)4
//Iftherewasanold