繁体   English   中英

Live555 RTSPServer对象销毁不当还是库bug?

[英]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 (和ClientConnectionClientSession )对象所管理。 相反,您可以在RTSPServer对象上调用Medium::close()

Ross Finlayson,Live Networks,Inc。, http://www.live555.com/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM