mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
测试用例
测试用例
This commit is contained in:
parent
f21a367d92
commit
f71a32bc8c
59
test.cpp
Normal file
59
test.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
//============================================================================
|
||||||
|
// Name : main.cpp
|
||||||
|
// Author : 熊子良
|
||||||
|
// Version :
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include "Util/SqlPool.h"
|
||||||
|
#include "Util/logger.h"
|
||||||
|
#include "Util/onceToken.h"
|
||||||
|
#include "Rtsp/UDPServer.h"
|
||||||
|
#include "Rtsp/RtspSession.h"
|
||||||
|
#include "Rtmp/RtmpSession.h"
|
||||||
|
#include "Network/TcpServer.h"
|
||||||
|
#include "Poller/EventPoller.hpp"
|
||||||
|
#include "Thread/WorkThreadPool.h"
|
||||||
|
#include "Http/HttpSession.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace ZL::Util;
|
||||||
|
using namespace ZL::Http;
|
||||||
|
using namespace ZL::Rtsp;
|
||||||
|
using namespace ZL::Rtmp;
|
||||||
|
using namespace ZL::Thread;
|
||||||
|
using namespace ZL::Network;
|
||||||
|
|
||||||
|
void programExit(int arg) {
|
||||||
|
EventPoller::Instance().shutdown();
|
||||||
|
}
|
||||||
|
int main(int argc,char *argv[]){
|
||||||
|
signal(SIGINT, programExit);
|
||||||
|
|
||||||
|
Logger::Instance().add(std::make_shared<ConsoleChannel>("stdout", LTrace));
|
||||||
|
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||||
|
|
||||||
|
TcpServer<RtspSession>::Ptr rtspSrv(new TcpServer<RtspSession>());
|
||||||
|
TcpServer<RtmpSession>::Ptr rtmpSrv(new TcpServer<RtmpSession>());
|
||||||
|
TcpServer<HttpSession>::Ptr httpSrv(new TcpServer<HttpSession>());
|
||||||
|
rtspSrv->start(mINI::Instance()[Config::Rtsp::kPort]);
|
||||||
|
rtmpSrv->start(mINI::Instance()[Config::Rtmp::kPort]);
|
||||||
|
httpSrv->start(mINI::Instance()[Config::Http::kPort]);
|
||||||
|
|
||||||
|
EventPoller::Instance().runLoop();
|
||||||
|
|
||||||
|
rtspSrv.reset();
|
||||||
|
rtmpSrv.reset();
|
||||||
|
httpSrv.reset();
|
||||||
|
static onceToken token(nullptr, []() {
|
||||||
|
UDPServer::Destory();
|
||||||
|
WorkThreadPool::Destory();
|
||||||
|
EventPoller::Destory();
|
||||||
|
Logger::Destory();
|
||||||
|
});
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user