mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
合并pr(#661): 减少unsport code打印,新增git信息获取
(cherry picked from commit 47f2f5b349
)
This commit is contained in:
parent
d37607026f
commit
3ddc14d35d
@ -1 +1 @@
|
|||||||
Subproject commit 7ae5f547c17ddc7bee7b82ebc114248df99de620
|
Subproject commit 322c71491a09d93a2c5c247a55e301c8229a2296
|
@ -2,10 +2,44 @@
|
|||||||
file(GLOB jsoncpp_src_list ../3rdpart/jsoncpp/*.cpp ../3rdpart/jsoncpp/*.h )
|
file(GLOB jsoncpp_src_list ../3rdpart/jsoncpp/*.cpp ../3rdpart/jsoncpp/*.h )
|
||||||
add_library(jsoncpp STATIC ${jsoncpp_src_list})
|
add_library(jsoncpp STATIC ${jsoncpp_src_list})
|
||||||
|
|
||||||
|
|
||||||
file(GLOB MediaServer_src_list ./*.cpp ./*.h)
|
file(GLOB MediaServer_src_list ./*.cpp ./*.h)
|
||||||
#message(STATUS ${MediaServer_src_list})
|
#message(STATUS ${MediaServer_src_list})
|
||||||
|
|
||||||
|
# 添加git版本信息
|
||||||
|
set(COMMIT_HASH "Git_NotFound_Unkown_commit")
|
||||||
|
set(BRANCH_NAME "Git_NotFound_Unkown_branch")
|
||||||
|
set(BUILD_TIME "")
|
||||||
|
|
||||||
|
string(TIMESTAMP BUILD_TIME "%Y/%m/%d-%H:%M:%S")
|
||||||
|
|
||||||
|
find_package(Git QUIET)
|
||||||
|
if(GIT_FOUND)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H
|
||||||
|
OUTPUT_VARIABLE COMMIT_HASH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_QUIET
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} symbolic-ref --short -q HEAD
|
||||||
|
OUTPUT_VARIABLE BRANCH_NAME
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_QUIET
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Git version is ${BRANCH_NAME}:${COMMIT_HASH}:${BUILD_TIME}")
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/version.h.ini
|
||||||
|
${CMAKE_BINARY_DIR}/Version.h
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
include_directories(${CMAKE_BINARY_DIR})
|
||||||
|
add_definitions(-DENABLE_VERSION)
|
||||||
|
|
||||||
add_executable(MediaServer ${MediaServer_src_list})
|
add_executable(MediaServer ${MediaServer_src_list})
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -8,10 +8,8 @@
|
|||||||
* may be found in the AUTHORS file in the root of the source tree.
|
* may be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Util/MD5.h"
|
|
||||||
#include "Util/File.h"
|
#include "Util/File.h"
|
||||||
#include "Util/logger.h"
|
#include "Util/logger.h"
|
||||||
#include "Util/SSLBox.h"
|
#include "Util/SSLBox.h"
|
||||||
@ -28,6 +26,10 @@
|
|||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include "WebHook.h"
|
#include "WebHook.h"
|
||||||
|
|
||||||
|
#if defined(ENABLE_VERSION)
|
||||||
|
#include "Version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
#endif//!defined(_WIN32)
|
#endif//!defined(_WIN32)
|
||||||
@ -146,10 +148,21 @@ public:
|
|||||||
false,/*该选项是否必须赋值,如果没有默认值且为ArgRequired时用户必须提供该参数否则将抛异常*/
|
false,/*该选项是否必须赋值,如果没有默认值且为ArgRequired时用户必须提供该参数否则将抛异常*/
|
||||||
"启动事件触发线程数",/*该选项说明文字*/
|
"启动事件触发线程数",/*该选项说明文字*/
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
|
#if defined(ENABLE_VERSION)
|
||||||
|
(*_parser) << Option('v', "version", Option::ArgNone, nullptr, false, "显示版本号",
|
||||||
|
[](const std::shared_ptr<ostream> &stream, const string &arg) -> bool {
|
||||||
|
//版本信息
|
||||||
|
*stream << "编译日期: " << build_time << std::endl;
|
||||||
|
*stream << "当前git分支: " << branch_name << std::endl;
|
||||||
|
*stream << "当前git hash值: " << commit_hash << std::endl;
|
||||||
|
throw ExitException();
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~CMD_main() {}
|
~CMD_main() override{}
|
||||||
virtual const char *description() const {
|
const char *description() const override{
|
||||||
return "主程序命令参数";
|
return "主程序命令参数";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -201,6 +214,8 @@ int start_main(int argc,char *argv[]) {
|
|||||||
CMD_main cmd_main;
|
CMD_main cmd_main;
|
||||||
try {
|
try {
|
||||||
cmd_main.operator()(argc, argv);
|
cmd_main.operator()(argc, argv);
|
||||||
|
} catch (ExitException &ex) {
|
||||||
|
return 0;
|
||||||
} catch (std::exception &ex) {
|
} catch (std::exception &ex) {
|
||||||
cout << ex.what() << endl;
|
cout << ex.what() << endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
11
server/version.h.ini
Normal file
11
server/version.h.ini
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef __GIT_VERSION_H__
|
||||||
|
#define __GIT_VERSION_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
const std::string commit_hash = "@COMMIT_HASH@";
|
||||||
|
const std::string branch_name = "@BRANCH_NAME@";
|
||||||
|
const std::string build_time = "@BUILD_TIME@";
|
||||||
|
|
||||||
|
#endif //__GIT_VERSION_H__
|
||||||
|
|
@ -215,8 +215,11 @@ void DecoderImp::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(codecid != 0){
|
if (codecid != 0) {
|
||||||
WarnL<< "unsupported codec type:" << getCodecName(codecid) << " " << (int)codecid;
|
if (_last_unsported_print.elapsedTime() / 1000 > 5) {
|
||||||
|
_last_unsported_print.resetTime();
|
||||||
|
WarnL << "unsupported codec type:" << getCodecName(codecid) << " " << (int) codecid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
Decoder::Ptr _decoder;
|
Decoder::Ptr _decoder;
|
||||||
MediaSinkInterface *_sink;
|
MediaSinkInterface *_sink;
|
||||||
FrameMerger _merger;
|
FrameMerger _merger;
|
||||||
|
Ticker _last_unsported_print;
|
||||||
};
|
};
|
||||||
|
|
||||||
}//namespace mediakit
|
}//namespace mediakit
|
||||||
|
Loading…
Reference in New Issue
Block a user