mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 03:31:45 +08:00
MediaServer支持Android
This commit is contained in:
@@ -32,7 +32,9 @@
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#ifndef ANDROID
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@@ -272,6 +274,7 @@ static string addr2line(const string &address) {
|
||||
return System::execute(cmd);
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
static void sig_crash(int sig) {
|
||||
signal(sig, SIG_DFL);
|
||||
void *array[MAX_STACK_FRAMES];
|
||||
@@ -295,6 +298,8 @@ static void sig_crash(int sig) {
|
||||
NoticeCenter::Instance().emitEvent(kBroadcastOnCrashDump,sig,stack);
|
||||
}
|
||||
|
||||
#endif//#ifndef ANDROID
|
||||
|
||||
|
||||
void System::startDaemon() {
|
||||
static pid_t pid;
|
||||
@@ -365,8 +370,11 @@ void System::systemSetup(){
|
||||
InfoL << "文件最大描述符个数设置为:" << rlim_new.rlim_cur;
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
signal(SIGSEGV, sig_crash);
|
||||
signal(SIGABRT, sig_crash);
|
||||
#endif//#ifndef ANDROID
|
||||
|
||||
NoticeCenter::Instance().addListener(nullptr,kBroadcastOnCrashDump,[](BroadcastOnCrashDumpArgs){
|
||||
stringstream ss;
|
||||
ss << "## crash date:" << currentDateTime() << endl;
|
||||
|
||||
@@ -205,7 +205,8 @@ static void inline listen_shell_input(){
|
||||
}
|
||||
#endif//!defined(_WIN32)
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
|
||||
int start_main(int argc,char *argv[]) {
|
||||
{
|
||||
CMD_main cmd_main;
|
||||
try {
|
||||
@@ -224,10 +225,12 @@ int main(int argc,char *argv[]) {
|
||||
|
||||
//设置日志
|
||||
Logger::Instance().add(std::make_shared<ConsoleChannel>("ConsoleChannel", logLevel));
|
||||
#ifndef ANDROID
|
||||
auto fileChannel = std::make_shared<FileChannel>("FileChannel", exeDir() + "log/", logLevel);
|
||||
//日志最多保存天数
|
||||
fileChannel->setMaxDay(cmd_main["max_day"]);
|
||||
Logger::Instance().add(fileChannel);
|
||||
#endif//
|
||||
|
||||
#if !defined(_WIN32)
|
||||
if (bDaemon) {
|
||||
@@ -287,7 +290,7 @@ int main(int argc,char *argv[]) {
|
||||
installWebHook();
|
||||
InfoL << "已启动http hook 接口";
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#if !defined(_WIN32) && !defined(ANDROID)
|
||||
if (!bDaemon) {
|
||||
//交互式shell输入
|
||||
listen_shell_input();
|
||||
@@ -316,3 +319,10 @@ int main(int argc,char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MAIN
|
||||
int main(int argc,char *argv[]) {
|
||||
return start_main(argc,argv);
|
||||
}
|
||||
#endif //DISABLE_MAIN
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user