Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick from develop, for srt utest. v5.0.185 #3816

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v5-changes"></a>

## SRS 5.0 Changelog
* v5.0, 2023-09-28, Merge [#3816](https://github.com/ossrs/srs/pull/3816): cherry-pick from develop, for srt utest. v5.0.185 (#3816)
* v5.0, 2023-09-21, Merge [#3806](https://github.com/ossrs/srs/pull/3806): Build: Support sys-ssl for srt. v5.0.184 (#3806)
* v5.0, 2023-09-21, Merge [#3808](https://github.com/ossrs/srs/pull/3808): Upgrade libsrt to v1.5.3. v5.0.183 (#3808)
* v5.0, 2023-09-21, Merge [#3404](https://github.com/ossrs/srs/pull/3404): WebRTC: Support WHEP for play. v5.0.182 (#3404)
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/app/srs_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7893,7 +7893,7 @@ unsigned short SrsConfig::get_srt_listen_port()
return (unsigned short)atoi(conf->arg0().c_str());
}

int SrsConfig::get_srto_maxbw()
int64_t SrsConfig::get_srto_maxbw()
{
SRS_OVERWRITE_BY_ENV_INT("srs.srt_server.maxbw"); // SRS_SRT_SERVER_MAXBW

Expand All @@ -7907,7 +7907,7 @@ int SrsConfig::get_srto_maxbw()
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return atoi(conf->arg0().c_str());
return atoll(conf->arg0().c_str());
}

int SrsConfig::get_srto_mss()
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class SrsConfig
// Get the srt service listen port
virtual unsigned short get_srt_listen_port();
// Get the srt SRTO_MAXBW, max bandwith, default is -1.
virtual int get_srto_maxbw();
virtual int64_t get_srto_maxbw();
// Get the srt SRTO_MSS, Maximum Segment Size, default is 1500.
virtual int get_srto_mss();
// Get the srt SRTO_TSBPDMODE, timestamp base packet delivery mode, default is false.
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_srt_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ srs_error_t SrsSrtAcceptor::set_srt_opt()
srs_error_t err = srs_success;

if ((err = srs_srt_set_maxbw(listener_->fd(), _srs_config->get_srto_maxbw())) != srs_success) {
return srs_error_wrap(err, "set opt maxbw=%d failed", _srs_config->get_srto_maxbw());
return srs_error_wrap(err, "set opt maxbw=%" PRId64 " failed", _srs_config->get_srto_maxbw());
}

if ((err = srs_srt_set_mss(listener_->fd(), _srs_config->get_srto_mss())) != srs_success) {
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 184
#define VERSION_REVISION 185

#endif
4 changes: 2 additions & 2 deletions trunk/src/protocol/srs_protocol_srt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ srs_error_t srs_srt_nonblock(srs_srt_t srt_fd)
return srs_success;
}

srs_error_t srs_srt_set_maxbw(srs_srt_t srt_fd, int maxbw)
srs_error_t srs_srt_set_maxbw(srs_srt_t srt_fd, int64_t maxbw)
{
SET_SRT_OPT(srt_fd, SRTO_MAXBW, maxbw);
return srs_success;
Expand Down Expand Up @@ -311,7 +311,7 @@ srs_error_t srs_srt_set_pbkeylen(srs_srt_t srt_fd, int pbkeylen)
return srs_success;
}

srs_error_t srs_srt_get_maxbw(srs_srt_t srt_fd, int& maxbw)
srs_error_t srs_srt_get_maxbw(srs_srt_t srt_fd, int64_t& maxbw)
{
GET_SRT_OPT(srt_fd, SRTO_MAXBW, maxbw);
return srs_success;
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/protocol/srs_protocol_srt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern srs_error_t srs_srt_listen(srs_srt_t srt_fd, std::string ip, int port);
extern srs_error_t srs_srt_nonblock(srs_srt_t srt_fd);

// Set SRT options.
extern srs_error_t srs_srt_set_maxbw(srs_srt_t srt_fd, int maxbw);
extern srs_error_t srs_srt_set_maxbw(srs_srt_t srt_fd, int64_t maxbw);
extern srs_error_t srs_srt_set_mss(srs_srt_t srt_fd, int mss);
extern srs_error_t srs_srt_set_payload_size(srs_srt_t srt_fd, int payload_size);
extern srs_error_t srs_srt_set_connect_timeout(srs_srt_t srt_fd, int timeout);
Expand All @@ -51,7 +51,7 @@ extern srs_error_t srs_srt_set_passphrase(srs_srt_t srt_fd, const std::string& p
extern srs_error_t srs_srt_set_pbkeylen(srs_srt_t srt_fd, int pbkeylen);

// Get SRT options.
extern srs_error_t srs_srt_get_maxbw(srs_srt_t srt_fd, int& maxbw);
extern srs_error_t srs_srt_get_maxbw(srs_srt_t srt_fd, int64_t& maxbw);
extern srs_error_t srs_srt_get_mss(srs_srt_t srt_fd, int& mss);
extern srs_error_t srs_srt_get_payload_size(srs_srt_t srt_fd, int& payload_size);
extern srs_error_t srs_srt_get_connect_timeout(srs_srt_t srt_fd, int& timeout);
Expand Down
7 changes: 4 additions & 3 deletions trunk/src/utest/srs_utest_srt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ VOID TEST(ServiceSrtPoller, SrtSetGetSocketOpt)
HELPER_EXPECT_SUCCESS(srs_srt_socket(&srt_fd));
HELPER_EXPECT_SUCCESS(srs_srt_nonblock(srt_fd));

int maxbw = 20000;
int64_t maxbw = 20000;
int mss = 1400;
int payload_size = 1316;
int connect_timeout = 5000;
Expand Down Expand Up @@ -104,10 +104,11 @@ VOID TEST(ServiceSrtPoller, SrtSetGetSocketOpt)

bool b;
int i = 0;
int64_t i64 = 0;
std::string s;

HELPER_EXPECT_SUCCESS(srs_srt_get_maxbw(srt_fd, i));
EXPECT_EQ(i, maxbw);
HELPER_EXPECT_SUCCESS(srs_srt_get_maxbw(srt_fd, i64));
EXPECT_EQ(i64, maxbw);
HELPER_EXPECT_SUCCESS(srs_srt_get_mss(srt_fd, i));
EXPECT_EQ(i, mss);
HELPER_EXPECT_SUCCESS(srs_srt_get_payload_size(srt_fd, i));
Expand Down