Skip to content

Commit

Permalink
Prevent the output of srt logs in utest
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhihong committed Sep 19, 2023
1 parent 6a4ace9 commit 2e876be
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions trunk/src/utest/srs_utest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ using namespace std;
#include <sys/mman.h>

#ifdef SRS_SRT
#include <srt/srt.h>
#include <srs_app_srt_server.hpp>
#endif

Expand All @@ -45,6 +46,14 @@ const char* _srs_binary = NULL;

#include <srs_app_st.hpp>

#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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 2e876be

Please sign in to comment.