mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
更新ZLToolKit(解决可能丢失事件的问题)
This commit is contained in:
parent
059c118e95
commit
4ab1d4ca44
@ -1 +1 @@
|
||||
Subproject commit 6d7e1bfafa98837f16c0645d8ea89e51e3f68fea
|
||||
Subproject commit 2814157d5998ea627a8a42d6e19ad5c4a2b767fc
|
@ -41,7 +41,8 @@ using namespace mediakit;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
//设置退出信号处理函数
|
||||
signal(SIGINT, [](int) { EventPollerPool::Instance().shutdown(); });
|
||||
static semaphore sem;
|
||||
signal(SIGINT, [](int) { sem.post(); });// 设置退出信号
|
||||
|
||||
//设置日志
|
||||
Logger::Instance().add(std::make_shared<ConsoleChannel>());
|
||||
@ -52,7 +53,6 @@ int main(int argc, char *argv[]) {
|
||||
<< "例如你想每隔50毫秒启动共计100个播放器(tcp方式播放rtsp://127.0.0.1/live/0 )可以输入以下命令:\r\n"
|
||||
<< "./test_benchmark 100 50 rtsp://127.0.0.1/live/0 0\r\n"
|
||||
<< endl;
|
||||
Logger::Destory();
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -81,8 +81,7 @@ int main(int argc, char *argv[]) {
|
||||
return true;
|
||||
});
|
||||
|
||||
EventPollerPool::Instance().wait();
|
||||
AsyncTaskThread::Instance().CancelTask(0);
|
||||
sem.wait();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,9 @@ static onceToken s_token([](){
|
||||
|
||||
int main(int argc,char *argv[]){
|
||||
//设置退出信号处理函数
|
||||
signal(SIGINT, [](int){EventPollerPool::Instance().shutdown();});
|
||||
static semaphore sem;
|
||||
signal(SIGINT, [](int) { sem.post(); });// 设置退出信号
|
||||
|
||||
//设置日志
|
||||
Logger::Instance().add(std::make_shared<ConsoleChannel>());
|
||||
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||
@ -133,7 +135,7 @@ int main(int argc,char *argv[]){
|
||||
|
||||
InfoL << "你可以在浏览器输入:http://127.0.0.1/api/my_api?key0=val0&key1=参数1" << endl;
|
||||
|
||||
EventPollerPool::Instance().wait();
|
||||
sem.wait();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,9 @@ using namespace mediakit;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
//设置退出信号处理函数
|
||||
signal(SIGINT, [](int) { EventPollerPool::Instance().shutdown(); });
|
||||
static semaphore sem;
|
||||
signal(SIGINT, [](int) { sem.post(); });// 设置退出信号
|
||||
|
||||
//设置日志
|
||||
Logger::Instance().add(std::make_shared<ConsoleChannel>());
|
||||
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||
@ -182,8 +184,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
});
|
||||
|
||||
//事件轮询
|
||||
EventPollerPool::Instance().wait();
|
||||
sem.wait();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ int main(int argc, char *argv[]) {
|
||||
ErrorL << "\r\n测试方法:./test_player rtxp_url rtp_type\r\n"
|
||||
<< "例如:./test_player rtsp://admin:123456@127.0.0.1/live/0 0\r\n"
|
||||
<< endl;
|
||||
Logger::Destory();
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
@ -83,7 +83,8 @@ void rePushDelay(const string &app, const string &stream, const string &url) {
|
||||
//这里才是真正执行main函数,你可以把函数名(domain)改成main,然后就可以输入自定义url了
|
||||
int domain(const string &playUrl, const string &pushUrl) {
|
||||
//设置退出信号处理函数
|
||||
signal(SIGINT, [](int) { EventPollerPool::Instance().shutdown(); });
|
||||
static semaphore sem;
|
||||
signal(SIGINT, [](int) { sem.post(); });// 设置退出信号
|
||||
//设置日志
|
||||
Logger::Instance().add(std::make_shared<ConsoleChannel>());
|
||||
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||
@ -101,8 +102,7 @@ int domain(const string &playUrl, const string &pushUrl) {
|
||||
createPusher(app, stream, pushUrl);
|
||||
}
|
||||
});
|
||||
//事件轮询
|
||||
EventPollerPool::Instance().wait();
|
||||
sem.wait();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,9 @@ void rePushDelay(const string &app,const string &stream,const string &url){
|
||||
//这里才是真正执行main函数,你可以把函数名(domain)改成main,然后就可以输入自定义url了
|
||||
int domain(const string & filePath,const string & pushUrl){
|
||||
//设置退出信号处理函数
|
||||
signal(SIGINT, [](int){EventPollerPool::Instance().shutdown();});
|
||||
static semaphore sem;
|
||||
signal(SIGINT, [](int) { sem.post(); });// 设置退出信号
|
||||
|
||||
//设置日志
|
||||
Logger::Instance().add(std::make_shared<ConsoleChannel>());
|
||||
Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||
@ -103,8 +105,7 @@ int domain(const string & filePath,const string & pushUrl){
|
||||
//限制app为record是为了防止服务器上的文件被肆意访问
|
||||
createPusher(appName,filePath,pushUrl);
|
||||
|
||||
//开始事件轮询
|
||||
EventPollerPool::Instance().wait();
|
||||
sem.wait();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,8 @@ static onceToken s_token([](){
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
//设置退出信号处理函数
|
||||
signal(SIGINT, [](int) { EventPollerPool::Instance().shutdown(); });
|
||||
static semaphore sem;
|
||||
signal(SIGINT, [](int) { sem.post(); });// 设置退出信号
|
||||
signal(SIGHUP, [](int) { loadIniConfig(); });
|
||||
|
||||
//设置日志
|
||||
@ -354,7 +355,7 @@ int main(int argc,char *argv[]) {
|
||||
}
|
||||
});
|
||||
|
||||
EventPollerPool::Instance().wait();
|
||||
sem.wait();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user