Avoid build warnings in the main code

This commit is contained in:
xia-chu 2024-03-30 14:59:28 +08:00
parent 0602cc0c0b
commit af3ef996b0
8 changed files with 17 additions and 17 deletions

View File

@ -191,7 +191,7 @@ if(UNIX)
set(COMPILE_OPTIONS_DEFAULT set(COMPILE_OPTIONS_DEFAULT
"-fPIC" "-fPIC"
"-Wall;-Wextra" "-Wall;-Wextra"
"-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable" "-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable;-Wno-deprecated-declarations"
"-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits") "-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")

View File

@ -142,7 +142,7 @@ API_EXPORT void API_CALL mk_media_source_find(const char *schema,
void *user_data, void *user_data,
on_mk_media_source_find_cb cb); on_mk_media_source_find_cb cb);
API_EXPORT const mk_media_source API_CALL mk_media_source_find2(const char *schema, API_EXPORT mk_media_source API_CALL mk_media_source_find2(const char *schema,
const char *vhost, const char *vhost,
const char *app, const char *app,
const char *stream, const char *stream,

View File

@ -278,7 +278,7 @@ API_EXPORT void API_CALL mk_media_source_find(const char *schema,
cb(user_data, (mk_media_source)src.get()); cb(user_data, (mk_media_source)src.get());
} }
API_EXPORT const mk_media_source API_CALL mk_media_source_find2(const char *schema, API_EXPORT mk_media_source API_CALL mk_media_source_find2(const char *schema,
const char *vhost, const char *vhost,
const char *app, const char *app,
const char *stream, const char *stream,

View File

@ -1564,7 +1564,7 @@ void installWebApi() {
api_regist("/index/api/deleteRecordDirectory", [](API_ARGS_MAP) { api_regist("/index/api/deleteRecordDirectory", [](API_ARGS_MAP) {
CHECK_SECRET(); CHECK_SECRET();
CHECK_ARGS("vhost", "app", "stream", "period"); CHECK_ARGS("vhost", "app", "stream", "period");
auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"]}; auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"], ""};
auto record_path = Recorder::getRecordPath(Recorder::type_mp4, tuple, allArgs["customized_path"]); auto record_path = Recorder::getRecordPath(Recorder::type_mp4, tuple, allArgs["customized_path"]);
auto period = allArgs["period"]; auto period = allArgs["period"];
record_path = record_path + period + "/"; record_path = record_path + period + "/";
@ -1603,7 +1603,7 @@ void installWebApi() {
api_regist("/index/api/getMP4RecordFile", [](API_ARGS_MAP){ api_regist("/index/api/getMP4RecordFile", [](API_ARGS_MAP){
CHECK_SECRET(); CHECK_SECRET();
CHECK_ARGS("vhost", "app", "stream"); CHECK_ARGS("vhost", "app", "stream");
auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"]}; auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"], ""};
auto record_path = Recorder::getRecordPath(Recorder::type_mp4, tuple, allArgs["customized_path"]); auto record_path = Recorder::getRecordPath(Recorder::type_mp4, tuple, allArgs["customized_path"]);
auto period = allArgs["period"]; auto period = allArgs["period"];

View File

@ -113,7 +113,7 @@ ProtocolOption::ProtocolOption() {
////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct MediaSourceNull : public MediaSource { struct MediaSourceNull : public MediaSource {
MediaSourceNull() : MediaSource("schema", MediaTuple{"vhost", "app", "stream"}) {}; MediaSourceNull() : MediaSource("schema", MediaTuple{"vhost", "app", "stream", ""}) {};
int readerCount() override { return 0; } int readerCount() override { return 0; }
}; };

View File

@ -38,7 +38,7 @@ MP4Reader::MP4Reader(const std::string &vhost, const std::string &app, const std
void MP4Reader::setup(const std::string &vhost, const std::string &app, const std::string &stream_id, const std::string &file_path, const ProtocolOption &option, toolkit::EventPoller::Ptr poller) { void MP4Reader::setup(const std::string &vhost, const std::string &app, const std::string &stream_id, const std::string &file_path, const ProtocolOption &option, toolkit::EventPoller::Ptr poller) {
//读写文件建议放在后台线程 //读写文件建议放在后台线程
auto tuple = MediaTuple{vhost, app, stream_id}; auto tuple = MediaTuple{vhost, app, stream_id, ""};
_poller = poller ? std::move(poller) : WorkThreadPool::Instance().getPoller(); _poller = poller ? std::move(poller) : WorkThreadPool::Instance().getPoller();
_file_path = file_path; _file_path = file_path;
if (_file_path.empty()) { if (_file_path.empty()) {

View File

@ -118,7 +118,7 @@ bool MP4Recorder::inputFrame(const Frame::Ptr &frame) {
//b帧情况下dts时间戳可能回退 //b帧情况下dts时间戳可能回退
_last_dts = MAX(frame->dts(), _last_dts); _last_dts = MAX(frame->dts(), _last_dts);
} }
auto duration = 5; // 默认至少一帧5ms auto duration = 5u; // 默认至少一帧5ms
if (frame->dts() > 0 && frame->dts() > _last_dts) { if (frame->dts() > 0 && frame->dts() > _last_dts) {
duration = MAX(duration, frame->dts() - _last_dts); duration = MAX(duration, frame->dts() - _last_dts);
} }

View File

@ -27,7 +27,7 @@ using namespace mediakit;
class FlvSplitterImp : public FlvSplitter { class FlvSplitterImp : public FlvSplitter {
public: public:
FlvSplitterImp() { FlvSplitterImp() {
_src = std::make_shared<RtmpMediaSourceImp>(MediaTuple{DEFAULT_VHOST, "live", "test"}); _src = std::make_shared<RtmpMediaSourceImp>(MediaTuple{DEFAULT_VHOST, "live", "test", ""});
} }
~FlvSplitterImp() override = default; ~FlvSplitterImp() override = default;