Merge branch '4.0release' into develop

pull/2128/head
winlin 4 years ago
commit 8fa093c53c

@ -209,6 +209,7 @@ For previous versions, please read:
## V3 changes ## V3 changes
* v3.0, 2020-12-26, For RTMP edge/forward, pass vhost in tcUrl, not in stream. 3.0.156
* v3.0, 2020-12-17, Fix [#1694][bug #1694], Support DVR 2GB+ MP4 file. 3.0.155 * v3.0, 2020-12-17, Fix [#1694][bug #1694], Support DVR 2GB+ MP4 file. 3.0.155
* v3.0, 2020-12-17, Fix [#1548][bug #1548], Add edts in MP4 for Windows10. 3.0.154 * v3.0, 2020-12-17, Fix [#1548][bug #1548], Add edts in MP4 for Windows10. 3.0.154
* <strong>v3.0, 2020-10-31, [3.0 release2(3.0.153)][r3.0r2] released. 122663 lines.</strong> * <strong>v3.0, 2020-10-31, [3.0 release2(3.0.153)][r3.0r2] released. 122663 lines.</strong>

@ -126,7 +126,9 @@ srs_error_t SrsEdgeRtmpUpstream::connect(SrsRequest* r, SrsLbRoundRobin* lb)
return srs_error_wrap(err, "edge pull %s failed, cto=%dms, sto=%dms.", url.c_str(), srsu2msi(cto), srsu2msi(sto)); return srs_error_wrap(err, "edge pull %s failed, cto=%dms, sto=%dms.", url.c_str(), srsu2msi(cto), srsu2msi(sto));
} }
if ((err = sdk->play(_srs_config->get_chunk_size(req->vhost))) != srs_success) { // For RTMP client, we pass the vhost in tcUrl when connecting,
// so we publish without vhost in stream.
if ((err = sdk->play(_srs_config->get_chunk_size(req->vhost), false)) != srs_success) {
return srs_error_wrap(err, "edge pull %s stream failed", url.c_str()); return srs_error_wrap(err, "edge pull %s stream failed", url.c_str());
} }
@ -507,7 +509,9 @@ srs_error_t SrsEdgeForwarder::start()
return srs_error_wrap(err, "sdk connect %s failed, cto=%dms, sto=%dms.", url.c_str(), srsu2msi(cto), srsu2msi(sto)); return srs_error_wrap(err, "sdk connect %s failed, cto=%dms, sto=%dms.", url.c_str(), srsu2msi(cto), srsu2msi(sto));
} }
if ((err = sdk->publish(_srs_config->get_chunk_size(req->vhost))) != srs_success) { // For RTMP client, we pass the vhost in tcUrl when connecting,
// so we publish without vhost in stream.
if ((err = sdk->publish(_srs_config->get_chunk_size(req->vhost), false)) != srs_success) {
return srs_error_wrap(err, "sdk publish"); return srs_error_wrap(err, "sdk publish");
} }
@ -517,7 +521,7 @@ srs_error_t SrsEdgeForwarder::start()
if ((err = trd->start()) != srs_success) { if ((err = trd->start()) != srs_success) {
return srs_error_wrap(err, "coroutine"); return srs_error_wrap(err, "coroutine");
} }
srs_trace("edge-fwr publish url %s", url.c_str()); srs_trace("edge-fwr publish url %s, stream=%s%s", url.c_str(), req->stream.c_str(), req->param.c_str());
return err; return err;
} }

@ -223,7 +223,9 @@ srs_error_t SrsForwarder::do_cycle()
return srs_error_wrap(err, "sdk connect url=%s, cto=%dms, sto=%dms.", url.c_str(), srsu2msi(cto), srsu2msi(sto)); return srs_error_wrap(err, "sdk connect url=%s, cto=%dms, sto=%dms.", url.c_str(), srsu2msi(cto), srsu2msi(sto));
} }
if ((err = sdk->publish(_srs_config->get_chunk_size(req->vhost))) != srs_success) { // For RTMP client, we pass the vhost in tcUrl when connecting,
// so we publish without vhost in stream.
if ((err = sdk->publish(_srs_config->get_chunk_size(req->vhost), false)) != srs_success) {
return srs_error_wrap(err, "sdk publish"); return srs_error_wrap(err, "sdk publish");
} }

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP #ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 155 #define SRS_VERSION3_REVISION 156
#endif #endif

@ -200,11 +200,12 @@ string srs_generate_tc_url(string host, string vhost, string app, int port)
return tcUrl; return tcUrl;
} }
string srs_generate_stream_with_query(string host, string vhost, string stream, string param) string srs_generate_stream_with_query(string host, string vhost, string stream, string param, bool with_vhost)
{ {
string url = stream; string url = stream;
string query = param; string query = param;
if (with_vhost) {
// If no vhost in param, try to append one. // If no vhost in param, try to append one.
string guessVhost; string guessVhost;
if (query.find("vhost=") == string::npos) { if (query.find("vhost=") == string::npos) {
@ -219,6 +220,7 @@ string srs_generate_stream_with_query(string host, string vhost, string stream,
if (!guessVhost.empty()) { if (!guessVhost.empty()) {
query += "&vhost=" + guessVhost; query += "&vhost=" + guessVhost;
} }
}
// Remove the start & when param is empty. // Remove the start & when param is empty.
query = srs_string_trim_start(query, "&"); query = srs_string_trim_start(query, "&");

@ -82,7 +82,7 @@ extern std::string srs_generate_tc_url(std::string host, std::string vhost, std:
* Generate the stream with param. * Generate the stream with param.
* @remark Append vhost in query string if not default vhost. * @remark Append vhost in query string if not default vhost.
*/ */
extern std::string srs_generate_stream_with_query(std::string host, std::string vhost, std::string stream, std::string param); extern std::string srs_generate_stream_with_query(std::string host, std::string vhost, std::string stream, std::string param, bool with_vhost = true);
/** /**
* create shared ptr message from bytes. * create shared ptr message from bytes.

@ -148,12 +148,12 @@ srs_error_t SrsBasicRtmpClient::do_connect_app(string local_ip, bool debug)
return err; return err;
} }
srs_error_t SrsBasicRtmpClient::publish(int chunk_size) srs_error_t SrsBasicRtmpClient::publish(int chunk_size, bool with_vhost)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
// Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733 // Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733
string stream = srs_generate_stream_with_query(req->host, req->vhost, req->stream, req->param); string stream = srs_generate_stream_with_query(req->host, req->vhost, req->stream, req->param, with_vhost);
// publish. // publish.
if ((err = client->publish(stream, stream_id, chunk_size)) != srs_success) { if ((err = client->publish(stream, stream_id, chunk_size)) != srs_success) {
@ -163,12 +163,12 @@ srs_error_t SrsBasicRtmpClient::publish(int chunk_size)
return err; return err;
} }
srs_error_t SrsBasicRtmpClient::play(int chunk_size) srs_error_t SrsBasicRtmpClient::play(int chunk_size, bool with_vhost)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
// Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733 // Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733
string stream = srs_generate_stream_with_query(req->host, req->vhost, req->stream, req->param); string stream = srs_generate_stream_with_query(req->host, req->vhost, req->stream, req->param, with_vhost);
if ((err = client->play(stream, stream_id, chunk_size)) != srs_success) { if ((err = client->play(stream, stream_id, chunk_size)) != srs_success) {
return srs_error_wrap(err, "connect with server failed, stream=%s, stream_id=%d", stream.c_str(), stream_id); return srs_error_wrap(err, "connect with server failed, stream=%s, stream_id=%d", stream.c_str(), stream_id);

@ -74,8 +74,8 @@ protected:
virtual srs_error_t connect_app(); virtual srs_error_t connect_app();
virtual srs_error_t do_connect_app(std::string local_ip, bool debug); virtual srs_error_t do_connect_app(std::string local_ip, bool debug);
public: public:
virtual srs_error_t publish(int chunk_size); virtual srs_error_t publish(int chunk_size, bool with_vhost = true);
virtual srs_error_t play(int chunk_size); virtual srs_error_t play(int chunk_size, bool with_vhost = true);
virtual void kbps_sample(const char* label, int64_t age); virtual void kbps_sample(const char* label, int64_t age);
virtual void kbps_sample(const char* label, int64_t age, int msgs); virtual void kbps_sample(const char* label, int64_t age, int msgs);
virtual int sid(); virtual int sid();

Loading…
Cancel
Save