diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index 0a7f4c35..7dc8456b 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -386,6 +386,9 @@ static void makeSockPair_l(std::pair &pair, const stri } void makeSockPair(std::pair &pair, const string &local_ip) { + //全局互斥锁保护,防止端口重复分配 + static recursive_mutex s_mtx; + lock_guard lck(s_mtx); int try_count = 0; while (true) { try {