mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Use thread-safe log for multiple-threading SRT module. (#2474)
* solve srt push bugs * solve h264 mutiple nalus in srt when obs is configured in zerolatency * optimize error code * optimize error code * optimize error code * add commemnt:we only skip pps/sps frame and send left nalus in srt * add commemnt:we only skip pps/sps frame and send left nalus in srt * optimize srt log system * update conf * update srt hpp Co-authored-by: shiwei <shiwei05@kuaishou.com>
This commit is contained in:
parent
4ca433d3f8
commit
4b7ba0e1e9
12 changed files with 268 additions and 62 deletions
36
trunk/src/srt/srt_log.cpp
Normal file
36
trunk/src/srt/srt_log.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "srt_log.hpp"
|
||||
#include "srt_to_rtmp.hpp"
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
LOGGER_LEVEL s_log_level = SRT_LOGGER_TRACE_LEVEL;
|
||||
static char* srt_log_buffer = new char[LOGGER_BUFFER_SIZE];
|
||||
|
||||
void snprintbuffer(char* buffer, size_t size, const char* fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buffer, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void set_srt_log_level(LOGGER_LEVEL level) {
|
||||
s_log_level = level;
|
||||
}
|
||||
|
||||
LOGGER_LEVEL get_srt_log_level() {
|
||||
return s_log_level;
|
||||
}
|
||||
|
||||
char* get_srt_log_buffer() {
|
||||
return srt_log_buffer;
|
||||
}
|
||||
|
||||
void srt_log_output(LOGGER_LEVEL level, const char* buffer) {
|
||||
std::string log_content(buffer);
|
||||
srt2rtmp::get_instance()->insert_log_message(level, log_content);
|
||||
return;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue