API_EXPORT int API_CALL initRtspServer(unsigned short port) { s_pRtspSrv.reset(new TcpServer<RtspSession>()); try { s_pRtspSrv->start(port); return 0; } catch (std::exception &ex) { s_pRtspSrv.reset(); WarnL << ex.what(); return -1; } }
API_EXPORT void API_CALL onAppStart(){ static onceToken s_token([](){ Logger::Instance().add(std::make_shared<ConsoleChannel>("stdout", LTrace)); EventPoller::Instance(true); cleaner::Instance().push_back([](){ s_pRtspSrv.reset(); s_pRtmpSrv.reset(); s_pHttpSrv.reset(); WorkThreadPool::Destory(); UDPServer::Destory(); AsyncTaskThread::Destory(); EventPoller::Destory(); DebugL << "clear common" << endl; Logger::Destory(); }); },nullptr); }