1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

WebRTC: Error message carries the SDP when failed. v5.0.151, v6.0.39 (#3450)

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: ChenGH <chengh_math@126.com>
This commit is contained in:
chundonglinlin 2023-03-27 22:27:01 +08:00 committed by GitHub
parent b34255c3d0
commit 571043ff3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 10 deletions

View file

@ -19,6 +19,8 @@
#include <vector>
using namespace std;
const int maxLogBuf = 4 * 1024 * 1024;
#if defined(SRS_BACKTRACE) && defined(__linux)
#include <execinfo.h>
#include <dlfcn.h>
@ -264,8 +266,8 @@ SrsCplxError* SrsCplxError::create(const char* func, const char* file, int line,
va_list ap;
va_start(ap, fmt);
static char buffer[4096];
int r0 = vsnprintf(buffer, sizeof(buffer), fmt, ap);
static char* buffer = new char[maxLogBuf];
int r0 = vsnprintf(buffer, maxLogBuf, fmt, ap);
va_end(ap);
SrsCplxError* err = new SrsCplxError();
@ -275,7 +277,7 @@ SrsCplxError* SrsCplxError::create(const char* func, const char* file, int line,
err->line = line;
err->code = code;
err->rerrno = rerrno;
if (r0 > 0 && r0 < (int)sizeof(buffer)) {
if (r0 > 0 && r0 < maxLogBuf) {
err->msg = string(buffer, r0);
}
err->wrapped = NULL;
@ -291,8 +293,8 @@ SrsCplxError* SrsCplxError::wrap(const char* func, const char* file, int line, S
va_list ap;
va_start(ap, fmt);
static char buffer[4096];
int r0 = vsnprintf(buffer, sizeof(buffer), fmt, ap);
static char* buffer = new char[maxLogBuf];
int r0 = vsnprintf(buffer, maxLogBuf, fmt, ap);
va_end(ap);
SrsCplxError* err = new SrsCplxError();
@ -304,7 +306,7 @@ SrsCplxError* SrsCplxError::wrap(const char* func, const char* file, int line, S
err->code = v->code;
}
err->rerrno = rerrno;
if (r0 > 0 && r0 < (int)sizeof(buffer)) {
if (r0 > 0 && r0 < maxLogBuf) {
err->msg = string(buffer, r0);
}
err->wrapped = v;