简体   繁体   English

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

[英]Live555 RTSPServer object destroyed improperly or the library bug?

I have a problem with destroying RTSPServer object: the app crashes with a SIGSEGV Error. 我在销毁RTSPServer对象时遇到问题:应用程序崩溃并出现SIGSEGV错误。 But the RTSPServer object might be destroyed only in the case if I do not touch all other objects. 但是,如果我不触及所有其他对象,则可能仅销毁RTSPServer对象。 Is this a library bug or am I doing something wrong? 这是库错误还是我做错了什么?

Their recent live555 changelog says: 他们最近的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.)

This is my destructor: 这是我的析构函数:

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;
    }
}

The answer to my question is now available here: http://lists.live555.com/pipermail/live-devel/2015-June/019490.html 现在可以在这里找到我的问题的答案: http//lists.live555.com/pipermail/live-devel/2015-June/019490.html

Response text: 回复文字:

I have a problem using Medium::close() in my destructor when deleting an RTSPServer object after I have already deleted ServerMediaSession* objects vector (of course, using Medium::close() too). 在我已经删除了ServerMediaSession*对象向量(当然,也使用Medium::close() )之后删除RTSPServer对象时,我在析构函数中使用Medium::close()RTSPServer

First, make sure that you are using the latest version of the software (a bug related to deleting RTSPServer's was fixed in version 2015.06.24). 首先,请确保您使用的是最新版本的软件(在2015.06.24版中修复了与删除RTSPServer's相关的错误)。

Second, be aware that once you have added a ServerMediaSession object to a RTSPServer , you must not delete the ServerMediaSession object by calling Medium::close() . 其次,请注意,一旦将ServerMediaSession对象添加到RTSPServer ,就不能通过调用Medium::close()删除ServerMediaSession对象。 Instead, you must use GenericMediaServer::deleteServerMediaSession() ( GenericMediaServer is the base class of RTSPServer ), so that the RTSPServer is told that the ServerMediaSession object is being deleted. 相反,你必须使用GenericMediaServer::deleteServerMediaSession() GenericMediaServer是基类的RTSPServer ),从而使RTSPServer被告知ServerMediaSession对象被删除。

Finally, however, note that you don't need to delete ServerMediaSession objects before you delete a RTSPServer , because the RTSPServer destructor will automatically delete any ServerMediaSession (and ClientConnection and ClientSession ) objects that it manages. 最后,但是,请注意,您不必删除ServerMediaSession对象在删除之前RTSPServer ,因为RTSPServer析构函数将自动删除任何ServerMediaSession (和ClientConnectionClientSession )对象所管理。 Instead, you can just call Medium::close() on your RTSPServer object. 相反,您可以在RTSPServer对象上调用Medium::close()

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

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

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