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

For #1575, use RTMP redirect as tcUrl and redirect2 as RTMP URL. 3.0.100

This commit is contained in:
winlin 2020-01-16 14:28:05 +08:00
parent 7240fe3040
commit 0e750ab3eb
8 changed files with 47 additions and 17 deletions

View file

@ -416,9 +416,14 @@ srs_error_t SrsEdgeIngester::process_publish_message(SrsCommonMessage* msg, stri
return err;
}
SrsAmf0Object* ex = prop->to_object();
if ((prop = ex->ensure_property_string("redirect")) == NULL) {
return err;
// The redirect is tcUrl while redirect2 is RTMP URL.
// https://github.com/ossrs/srs/issues/1575#issuecomment-574999798
if ((prop = ex->ensure_property_string("redirect2")) == NULL) {
// TODO: FIXME: Remove it when SRS3 released, it's temporarily support for SRS3 alpha versions(a0 to a8).
if ((prop = ex->ensure_property_string("redirect")) == NULL) {
return err;
}
}
redirect = prop->to_str();

View file

@ -621,8 +621,10 @@ srs_error_t SrsRtmpConn::playing(SrsSource* source)
}
return srs_error_wrap(err, "discover coworkers, url=%s", url.c_str());
}
srs_trace("rtmp: redirect in cluster, from=%s:%d, target=%s:%d, url=%s",
req->host.c_str(), req->port, host.c_str(), port, url.c_str());
string rurl = srs_generate_rtmp_url(host, port, req->host, req->vhost, req->app, req->stream, req->param);
srs_trace("rtmp: redirect in cluster, from=%s:%d, target=%s:%d, url=%s, rurl=%s",
req->host.c_str(), req->port, host.c_str(), port, url.c_str(), rurl.c_str());
// Ignore if host or port is invalid.
if (host.empty() || port == 0) {
@ -630,7 +632,7 @@ srs_error_t SrsRtmpConn::playing(SrsSource* source)
}
bool accepted = false;
if ((err = rtmp->redirect(req, host, port, accepted)) != srs_success) {
if ((err = rtmp->redirect(req, rurl, accepted)) != srs_success) {
srs_error_reset(err);
} else {
return srs_error_new(ERROR_CONTROL_REDIRECT, "redirected");

View file

@ -217,7 +217,7 @@ void SrsFastVector::push_back(SrsSharedPtrMessage* msg)
for (int i = 0; i < nb_msgs; i++) {
buf[i] = msgs[i];
}
srs_warn("fast vector incrase %d=>%d", nb_msgs, size);
srs_info("fast vector incrase %d=>%d", nb_msgs, size);
// use new array.
srs_freepa(msgs);