Skip to content

Commit

Permalink
WebRTC: Error message carries the SDP when failed. v5.0.151, v6.0.39 (o…
Browse files Browse the repository at this point in the history
…ssrs#3450)

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: ChenGH <chengh_math@126.com>
  • Loading branch information
3 people authored and duiniuluantanqin committed Mar 31, 2023
1 parent 550cb16 commit 34579b8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for SRS.

## SRS 6.0 Changelog

* v6.0, 2023-03-27, Merge [#3450](https://github.com/ossrs/srs/pull/3450): WebRTC: Error message carries the SDP when failed. v6.0.39 (#3450)
* v6.0, 2023-03-25, Merge [#3477](https://github.com/ossrs/srs/pull/3477): Remove unneccessary NULL check in srs_freep. v6.0.38 (#3477)
* v6.0, 2023-03-25, Merge [#3455](https://github.com/ossrs/srs/pull/3455): RTC: Call on_play before create session, for it might be freed for timeout. v6.0.37 (#3455)
* v6.0, 2023-03-22, Merge [#3427](https://github.com/ossrs/srs/pull/3427): WHIP: Support DELETE resource for Larix Broadcaster. v6.0.36 (#3427)
Expand Down Expand Up @@ -52,6 +53,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* v5.0, 2023-03-27, Merge [#3450](https://github.com/ossrs/srs/pull/3450): WebRTC: Error message carries the SDP when failed. v5.0.151 (#3450)
* v5.0, 2023-03-25, Merge [#3477](https://github.com/ossrs/srs/pull/3477): Remove unneccessary NULL check in srs_freep. v5.0.150 (#3477)
* v5.0, 2023-03-25, Merge [#3455](https://github.com/ossrs/srs/pull/3455): RTC: Call on_play before create session, for it might be freed for timeout. v5.0.149 (#3455)
* v5.0, 2023-03-22, Merge [#3427](https://github.com/ossrs/srs/pull/3427): WHIP: Support DELETE resource for Larix Broadcaster. v5.0.148 (#3427)
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ srs_error_t SrsRtcConnection::add_publisher(SrsRtcUserConfig* ruc, SrsSdp& local

// TODO: FIXME: Change to api of stream desc.
if ((err = negotiate_publish_capability(ruc, stream_desc)) != srs_success) {
return srs_error_wrap(err, "publish negotiate, offer=%s", ruc->remote_sdp_str_.c_str());
return srs_error_wrap(err, "publish negotiate, offer=%s", srs_string_replace(ruc->remote_sdp_str_.c_str(), "\r\n", "\\r\\n").c_str());
}

if ((err = generate_publish_local_sdp(req, local_sdp, stream_desc, ruc->remote_sdp_.is_unified(), ruc->audio_before_video_)) != srs_success) {
Expand Down Expand Up @@ -1935,7 +1935,7 @@ srs_error_t SrsRtcConnection::add_player(SrsRtcUserConfig* ruc, SrsSdp& local_sd

std::map<uint32_t, SrsRtcTrackDescription*> play_sub_relations;
if ((err = negotiate_play_capability(ruc, play_sub_relations)) != srs_success) {
return srs_error_wrap(err, "play negotiate, offer=%s", ruc->remote_sdp_str_.c_str());
return srs_error_wrap(err, "play negotiate, offer=%s", srs_string_replace(ruc->remote_sdp_str_.c_str(), "\r\n", "\\r\\n").c_str());
}

if (!play_sub_relations.size()) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 150
#define VERSION_REVISION 151

#endif
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 38
#define VERSION_REVISION 39

#endif
14 changes: 8 additions & 6 deletions trunk/src/kernel/srs_kernel_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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();
Expand All @@ -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;
Expand Down

0 comments on commit 34579b8

Please sign in to comment.