From 2e876befc8739fd9dff5a74054e2773495647041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E5=BF=97=E5=AE=8F?= Date: Tue, 19 Sep 2023 18:09:15 +0800 Subject: [PATCH] Prevent the output of srt logs in utest --- trunk/src/utest/srs_utest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/trunk/src/utest/srs_utest.cpp b/trunk/src/utest/srs_utest.cpp index 800d250e93..b47f73d932 100644 --- a/trunk/src/utest/srs_utest.cpp +++ b/trunk/src/utest/srs_utest.cpp @@ -21,6 +21,7 @@ using namespace std; #include #ifdef SRS_SRT +#include #include #endif @@ -45,6 +46,14 @@ const char* _srs_binary = NULL; #include +#ifdef SRS_SRT +static void srs_srt_utest_null_log_handler(void* opaque, int level, const char* file, int line, + const char* area, const char* message) +{ + // srt null log handler, do no print any log. +} +#endif + // Initialize global settings. srs_error_t prepare_main() { srs_error_t err = srs_success; @@ -72,6 +81,9 @@ srs_error_t prepare_main() { return srs_error_wrap(err, "srt log initialize"); } + // Prevent the output of srt logs in utest. + srt_setloghandler(NULL, srs_srt_utest_null_log_handler); + _srt_eventloop = new SrsSrtEventLoop(); if ((err = _srt_eventloop->initialize()) != srs_success) { return srs_error_wrap(err, "srt poller initialize");