From 0a09cdaeeaa2970ed8dc9fc4b4240f5bf87263e3 Mon Sep 17 00:00:00 2001 From: yangkun Date: Fri, 27 Oct 2023 13:54:31 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=B1=80=E9=83=A8=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=89=8D=E9=9D=A2=E7=9A=84=E4=B8=8B=E5=88=92?= =?UTF-8?q?=E7=BA=BF=202.=20windows=E7=B3=BB=E7=BB=9F=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E6=97=B6strncasecmp=20=E4=B8=BA=5Fstrnicmp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtmp/RtmpPusher.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Rtmp/RtmpPusher.cpp b/src/Rtmp/RtmpPusher.cpp index 27e00ae7..ee7d560b 100644 --- a/src/Rtmp/RtmpPusher.cpp +++ b/src/Rtmp/RtmpPusher.cpp @@ -62,28 +62,32 @@ void RtmpPusher::onPublishResult_l(const SockException &ex, bool handshake_done) shutdown(SockException(Err_shutdown,"teardown")); } } - +#ifdef _MSC_VER +//not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw +#define strncasecmp _strnicmp +#define strcasecmp _stricmp +#endif void RtmpPusher::publish(const string &url) { teardown(); - string _head ; + string head ; // rtmps rt_url head should be rtmps const char *rtmp_head = "rtmp://"; const char *rtmps_head = "rtmps://"; if(0 == strncasecmp(url.c_str(), rtmp_head, strlen(rtmp_head))) { - _head = rtmp_head; + head = rtmp_head; } if(0 == strncasecmp(url.c_str(), rtmps_head, strlen(rtmps_head))) { - _head = rtmps_head; + head = rtmps_head; } string host_url = findSubString(url.data(), "://", "/"); _app = findrSubString(url.data(), (host_url + "/").data(), '/'); _stream_id = findSubString(url.data(), (host_url + "/" + _app + "/").data(), NULL); - _tc_url = _head + host_url + "/" + _app; + _tc_url = head + host_url + "/" + _app; - if (!_app.size() || !_stream_id.size() || !_head.size()) { + if (!_app.size() || !_stream_id.size() || !head.size()) { onPublishResult_l(SockException(Err_other, "rtmp url非法"), false); return; }