diff --git a/plugins/input_rtsp/input_rtsp_node.cpp b/plugins/input_rtsp/input_rtsp_node.cpp index e50da20..d68df36 100644 --- a/plugins/input_rtsp/input_rtsp_node.cpp +++ b/plugins/input_rtsp/input_rtsp_node.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -110,6 +111,22 @@ public: private: #if defined(RK3588_ENABLE_FFMPEG) + static bool IContainsNoCase(const char* haystack, const char* needle) { + if (!haystack || !needle) return false; + const size_t nlen = std::strlen(needle); + if (nlen == 0) return true; + for (const char* p = haystack; *p; ++p) { + size_t i = 0; + while (i < nlen && p[i] && + std::tolower(static_cast(p[i])) == + std::tolower(static_cast(needle[i]))) { + ++i; + } + if (i == nlen) return true; + } + return false; + } + static void InstallFfmpegLogFilterOnce() { static std::once_flag once; std::call_once(once, []() { @@ -125,11 +142,11 @@ private: buf[sizeof(buf) - 1] = '\0'; const char* item = avcl ? av_default_item_name(avcl) : ""; - if (item && std::strstr(item, "rtsp") != nullptr) { + // Note: item name can be "rtsp" or "RTSP" depending on build. + if (InputRtspNode::IContainsNoCase(item, "rtsp")) { // Seen during startup/probing on some cameras; not fatal if we later decode fine. - if (std::strstr(buf, "decoding for stream") && std::strstr(buf, "failed")) { - return; // drop - } + if (InputRtspNode::IContainsNoCase(buf, "decoding for stream") && InputRtspNode::IContainsNoCase(buf, "failed")) return; + if (InputRtspNode::IContainsNoCase(buf, "not enough frames to estimate rate")) return; } va_list vl_default;