mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix #1031, Always use vhost in stream query, the unify uri. 3.0.35
This commit is contained in:
parent
8cf5df5afb
commit
68a1656e07
18 changed files with 102 additions and 159 deletions
|
@ -134,7 +134,7 @@ srs_error_t SrsBasicRtmpClient::do_connect_app(string local_ip, bool debug)
|
|||
// generate the tcUrl
|
||||
std::string param = "";
|
||||
std::string target_vhost = req->vhost;
|
||||
std::string tc_url = srs_generate_tc_url(req->host, req->vhost, req->app, req->port, param);
|
||||
std::string tc_url = srs_generate_tc_url(req->host, req->vhost, req->app, req->port);
|
||||
|
||||
// replace the tcUrl in request,
|
||||
// which will replace the tc_url in client.connect_app().
|
||||
|
@ -150,43 +150,29 @@ srs_error_t SrsBasicRtmpClient::do_connect_app(string local_ip, bool debug)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsBasicRtmpClient::publish()
|
||||
srs_error_t SrsBasicRtmpClient::publish(int chunk_size)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
string stream = req->stream;
|
||||
|
||||
// Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733
|
||||
if (!req->param.empty()) {
|
||||
if (req->param.find("?") != 0) {
|
||||
stream += "?";
|
||||
}
|
||||
stream += req->param;
|
||||
}
|
||||
string stream = srs_generate_stream_with_query(req->host, req->vhost, req->stream, req->param);
|
||||
|
||||
// publish.
|
||||
if ((err = client->publish(stream, stream_id)) != srs_success) {
|
||||
if ((err = client->publish(stream, stream_id, chunk_size)) != srs_success) {
|
||||
return srs_error_wrap(err, "publish failed, stream=%s, stream_id=%d", stream.c_str(), stream_id);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsBasicRtmpClient::play()
|
||||
srs_error_t SrsBasicRtmpClient::play(int chunk_size)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
string stream = req->stream;
|
||||
|
||||
// Pass params in stream, @see https://github.com/ossrs/srs/issues/1031#issuecomment-409745733
|
||||
if (!req->param.empty()) {
|
||||
if (req->param.find("?") != 0) {
|
||||
stream += "?";
|
||||
}
|
||||
stream += req->param;
|
||||
}
|
||||
string stream = srs_generate_stream_with_query(req->host, req->vhost, req->stream, req->param);
|
||||
|
||||
if ((err = client->play(stream, stream_id)) != 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ protected:
|
|||
virtual srs_error_t connect_app();
|
||||
virtual srs_error_t do_connect_app(std::string local_ip, bool debug);
|
||||
public:
|
||||
virtual srs_error_t publish();
|
||||
virtual srs_error_t play();
|
||||
virtual srs_error_t publish(int chunk_size);
|
||||
virtual srs_error_t play(int chunk_size);
|
||||
virtual void kbps_sample(const char* label, int64_t age);
|
||||
virtual void kbps_sample(const char* label, int64_t age, int msgs);
|
||||
virtual int sid();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue