From ad9f3bf357c970f2f276392885826d7f21010539 Mon Sep 17 00:00:00 2001 From: Dimiden Date: Fri, 27 Dec 2024 15:34:02 +0900 Subject: [PATCH] Fixed compile warnings --- src/projects/base/info/application.h | 2 ++ .../base/info/decoder_configuration_record.h | 2 ++ src/projects/base/ovlibrary/dump_utilities.cpp | 4 ++-- src/projects/base/ovlibrary/memory_utilities.h | 17 ++++++++++++++--- src/projects/modules/rtp_rtcp/rtp_packet.cpp | 2 +- src/projects/modules/segment_writer/writer.cpp | 2 ++ src/projects/monitoring/application_metrics.h | 5 ++++- src/projects/monitoring/host_metrics.h | 9 +++++++-- src/projects/transcoder/transcoder_encoder.cpp | 2 +- 9 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/projects/base/info/application.h b/src/projects/base/info/application.h index 802e47fce..c95aefd5d 100644 --- a/src/projects/base/info/application.h +++ b/src/projects/base/info/application.h @@ -32,6 +32,8 @@ namespace info class Application { public: + virtual ~Application() = default; + virtual const char *GetApplicationTypeName() { return "ApplicationInfo"; diff --git a/src/projects/base/info/decoder_configuration_record.h b/src/projects/base/info/decoder_configuration_record.h index 8a929c344..868d1445b 100644 --- a/src/projects/base/info/decoder_configuration_record.h +++ b/src/projects/base/info/decoder_configuration_record.h @@ -5,6 +5,8 @@ class DecoderConfigurationRecord { public: + virtual ~DecoderConfigurationRecord() = default; + std::shared_ptr GetData() { if (_updated) diff --git a/src/projects/base/ovlibrary/dump_utilities.cpp b/src/projects/base/ovlibrary/dump_utilities.cpp index 34a7ae5b5..11ae8f389 100644 --- a/src/projects/base/ovlibrary/dump_utilities.cpp +++ b/src/projects/base/ovlibrary/dump_utilities.cpp @@ -136,12 +136,12 @@ namespace ov if (offset > 0) { // ========== xxxxx 0x12345678 + 0xABCDEF01 (102400 / 1024000) ========== - dump.AppendFormat("%s========== %s 0x%08X + 0x%08X (%d/%" PRIi64 " bytes) ==========", line_prefix, title, data, offset, dump_bytes, length); + dump.AppendFormat("%s========== %s 0x%08llX + 0x%08llX (%d/%" PRIi64 " bytes) ==========", line_prefix, title, data, offset, dump_bytes, length); } else { // ========== xxxxx 0x12345678 (102400 / 1024000) ========== - dump.AppendFormat("%s========== %s 0x%08X (%d/%" PRIi64 " bytes) ==========", line_prefix, title, data, dump_bytes, length); + dump.AppendFormat("%s========== %s 0x%08llX (%d/%" PRIi64 " bytes) ==========", line_prefix, title, data, dump_bytes, length); } if (dump_bytes == 0L) diff --git a/src/projects/base/ovlibrary/memory_utilities.h b/src/projects/base/ovlibrary/memory_utilities.h index 4e7ed5bf5..a5c8e64ef 100644 --- a/src/projects/base/ovlibrary/memory_utilities.h +++ b/src/projects/base/ovlibrary/memory_utilities.h @@ -38,11 +38,22 @@ #if __cplusplus namespace ov { - template , int> = 0> + template >, typename U = typename std::underlying_type_t> inline bool CheckFlag(const T &lhs, const T &rhs) { - using U = typename std::underlying_type::type; - return OV_CHECK_FLAG(static_cast(lhs), static_cast(rhs)); + return OV_CHECK_FLAG(static_cast(lhs), static_cast(rhs)); + } + + template >, typename U = typename std::underlying_type_t> + inline bool CheckFlag(const T &lhs, const U &rhs) + { + return OV_CHECK_FLAG(static_cast(lhs), static_cast(rhs)); + } + + template >, typename U = typename std::underlying_type_t> + inline bool CheckFlag(const U &lhs, const T &rhs) + { + return OV_CHECK_FLAG(static_cast(lhs), static_cast(rhs)); } } // namespace ov #endif // __cplusplus diff --git a/src/projects/modules/rtp_rtcp/rtp_packet.cpp b/src/projects/modules/rtp_rtcp/rtp_packet.cpp index 5b0531398..3f9ccc88c 100644 --- a/src/projects/modules/rtp_rtcp/rtp_packet.cpp +++ b/src/projects/modules/rtp_rtcp/rtp_packet.cpp @@ -402,7 +402,7 @@ void RtpPacket::SetExtensions(const RtpHeaderExtensions& extensions) // Write Extensions auto extensions_map = extensions.GetMap(); - for(const auto [id, extension] : extensions_map) + for(const auto &[id, extension] : extensions_map) { _extension_buffer_offset[id] = offset; diff --git a/src/projects/modules/segment_writer/writer.cpp b/src/projects/modules/segment_writer/writer.cpp index c26ec6085..c1e534b95 100644 --- a/src/projects/modules/segment_writer/writer.cpp +++ b/src/projects/modules/segment_writer/writer.cpp @@ -864,6 +864,8 @@ bool Writer::WritePacket(const std::shared_ptr &packet) [[fallthrough]]; case cmn::BitstreamFormat::OVEN_EVENT: [[fallthrough]]; + case cmn::BitstreamFormat::CUE: + [[fallthrough]]; case cmn::BitstreamFormat::PNG: break; } diff --git a/src/projects/monitoring/application_metrics.h b/src/projects/monitoring/application_metrics.h index 8398f4b55..9f3a81fd7 100644 --- a/src/projects/monitoring/application_metrics.h +++ b/src/projects/monitoring/application_metrics.h @@ -31,11 +31,14 @@ namespace mon ~ApplicationMetrics() { _host_metrics.reset(); + + std::unique_lock lock(_streams_guard); _streams.clear(); } void Release() { + std::unique_lock lock(_streams_guard); _streams.clear(); } @@ -67,4 +70,4 @@ namespace mon mutable std::shared_mutex _reserved_streams_guard; std::map> _reserved_streams; }; -} // namespace mon \ No newline at end of file +} // namespace mon diff --git a/src/projects/monitoring/host_metrics.h b/src/projects/monitoring/host_metrics.h index 53ff74be3..6e4de8646 100644 --- a/src/projects/monitoring/host_metrics.h +++ b/src/projects/monitoring/host_metrics.h @@ -32,11 +32,16 @@ namespace mon void Release() { - for (const auto &app : _applications) + std::map> applications; + { + std::unique_lock lock(_map_guard); + applications = std::move(_applications); + } + + for (const auto &app : applications) { app.second->Release(); } - _applications.clear(); } ov::String GetInfoString(bool show_children = true) override; diff --git a/src/projects/transcoder/transcoder_encoder.cpp b/src/projects/transcoder/transcoder_encoder.cpp index 530415bb2..81be3f01f 100644 --- a/src/projects/transcoder/transcoder_encoder.cpp +++ b/src/projects/transcoder/transcoder_encoder.cpp @@ -382,7 +382,7 @@ void TranscodeEncoder::SendBuffer(std::shared_ptr frame) void TranscodeEncoder::SetCompleteHandler(CompleteHandler complete_handler) { - _complete_handler = move(complete_handler); + _complete_handler = std::move(complete_handler); } void TranscodeEncoder::Complete(std::shared_ptr packet)