46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
|
|
// Project_ServerVedioPush.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#include <iostream>
|
|||
|
|
#include <thread>
|
|||
|
|
#include <mutex>
|
|||
|
|
|
|||
|
|
#include "Task_Ffmpeg/TaskFfmpeg.h"
|
|||
|
|
#include "Task_PingMoniotor/TaskPingMoniotor.h"
|
|||
|
|
#include "Task_NetMonitor/TaskNetMonitor.h"
|
|||
|
|
|
|||
|
|
using namespace std;
|
|||
|
|
|
|||
|
|
int main()
|
|||
|
|
{
|
|||
|
|
int ret;
|
|||
|
|
thread threadFfmpegPushVedio;
|
|||
|
|
thread threadPing;
|
|||
|
|
/* 初始化 */
|
|||
|
|
ret = Task_FfmpegInit();
|
|||
|
|
if (ret < 0) {
|
|||
|
|
system("pause");
|
|||
|
|
exit(0);
|
|||
|
|
}
|
|||
|
|
ret = PingMoniotorInit();
|
|||
|
|
if (ret < 0) {
|
|||
|
|
system("pause");
|
|||
|
|
exit(0);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 创建一个FFMPEG推流转码的线程 */
|
|||
|
|
threadFfmpegPushVedio = thread(Task_FfmpegPushVedio);
|
|||
|
|
/* 创建一个本地联网的线程,用于判断本地网络是否已经连接 */
|
|||
|
|
|
|||
|
|
/* 创建一个本地的ping线程,用于判断对方是否已经上线 */
|
|||
|
|
threadPing = thread(Task_PingMoniotor);
|
|||
|
|
/* 等待推流线程结束 */
|
|||
|
|
threadFfmpegPushVedio.join();
|
|||
|
|
/* 等待本地联网线程结束 */
|
|||
|
|
|
|||
|
|
/* 等待本地的ping线程结束 */
|
|||
|
|
threadPing.join();
|
|||
|
|
system("pause");
|
|||
|
|
exit(0);
|
|||
|
|
}
|