[英]Live555 RTSPServer object destroyed improperly or the library bug?
我在销毁RTSPServer
对象时遇到问题:应用程序崩溃并出现SIGSEGV
错误。 但是,如果我不触及所有其他对象,则可能仅销毁RTSPServer
对象。 这是库错误还是我做错了什么?
他们最近的live555更改日志说:
2015.05.12:
- Updated the previous revision to change the order in which fields are deleted
in the "RTSPServer" destructor, to avoid a possible crash if "RTSPServer"
objects are deleted. (Thanks to ChaSeop Im for noting the problem.)
这是我的析构函数:
RTSPServerH264::~RTSPServerH264()
{
LOG(INFO) << "RTSP server close: destroying objects";
if (mSms.size() > 0)
{
LOG(INFO) << "destroying: Server Media Subsession vector";
for (ServerMediaSession* s : mSms)
{
s->deleteAllSubsessions();
Medium::close(s);
}
mSms.clear();
mLiveSubsession.clear();
}
if (mRTSPServer)
{
LOG(INFO) << "destroying: RTSPServer";
// BUG: Destroying RTSPServer object crashes the whole application!
Medium::close(mRTSPServer);
}
if (mUsageEnvironment)
{
LOG(INFO) << "destroying: Usage Environment";
mUsageEnvironment->reclaim();
}
if (mTaskScheduler)
{
LOG(INFO) << "destroying: Task Scheduler";
delete mTaskScheduler;
}
}
现在可以在这里找到我的问题的答案: http : //lists.live555.com/pipermail/live-devel/2015-June/019490.html
回复文字:
在我已经删除了
ServerMediaSession*
对象向量(当然,也使用Medium::close()
)之后删除RTSPServer
对象时,我在析构函数中使用Medium::close()
时RTSPServer
。首先,请确保您使用的是最新版本的软件(在2015.06.24版中修复了与删除
RTSPServer's
相关的错误)。其次,请注意,一旦将
ServerMediaSession
对象添加到RTSPServer
,就不能通过调用Medium::close()
删除ServerMediaSession
对象。 相反,你必须使用GenericMediaServer::deleteServerMediaSession()
GenericMediaServer
是基类的RTSPServer
),从而使RTSPServer
被告知ServerMediaSession
对象被删除。最后,但是,请注意,您不必删除
ServerMediaSession
对象在删除之前RTSPServer
,因为RTSPServer
析构函数将自动删除任何ServerMediaSession
(和ClientConnection
和ClientSession
)对象所管理。 相反,您可以在RTSPServer
对象上调用Medium::close()
。Ross Finlayson,Live Networks,Inc。, http://www.live555.com/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.