那么,
当我的OpenRtsp客户端与服务器失去连接时,我会将其丢弃 旧客户端和其他参数然后重新创建新客户端。
客户端发送选项,成功描述请求但在此之后失败...我无法创建会话和子会话,因此我收到了访问冲突错误..
如何正确重置旧的OpenRtspClient以获得新的“品牌”RTSPClient?
我目前重置旧客户的方法:
我只是修改了playCommon类中的“shutdown”方法。我没有发送拆解......
...
void ResetOurClient(){
if (env != NULL) {
env->taskScheduler().unscheduleDelayedTask(sessionTimerTask);
env->taskScheduler().unscheduleDelayedTask(arrivalCheckTimerTask);
env->taskScheduler().unscheduleDelayedTask(interPacketGapCheckTimerTask);
env->taskScheduler().unscheduleDelayedTask(qosMeasurementTimerTask);
}
closeMediaSinks();
Medium::close(session);
delete ourAuthenticator;
Medium::close(ourClient);
}
和我的ReStartCode:
void StartOurClient()
{
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
char* streamURL = "XXXXXXXXX";
// Create our client object:
ourClient = createClient(*env, streamURL, verbosityLevel, progName);
if (ourClient == NULL) {
*env << "Failed to create " << clientProtocolName
<< " client: " << env->getResultMsg() << "\n";
shutdown();
}
if (sendOptionsRequest) {
// Begin by sending an "OPTIONS" command:
getOptions(continueAfterOPTIONS);
} else {
continueAfterOPTIONS(NULL, 0, NULL);
}
// All subsequent activity takes place within the event loop:
env->taskScheduler().doEventLoop(&continuesStream); // does not return
}
答案 0 :(得分:0)
(在问题编辑中由OP回答。转换为社区维基答案。请参阅Question with no answers, but issue solved in the comments (or extended in chat))
OP写道:在
setUpIter
方法中有一个静态变量[MediaSubsessionIterator* setupIter = NULL;]
...setupstreams
...所以将它作为全局非静态变量并在NULL
处{ {1}}