mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
SRT: Undo extract of fetch_or_create_source and change mode_ to local.
This commit is contained in:
parent
6009395c10
commit
9a0db5a14f
2 changed files with 15 additions and 28 deletions
|
@ -167,7 +167,6 @@ SrsMpegtsSrtConn::SrsMpegtsSrtConn(SrsSrtServer* srt_server, srs_srt_t srt_fd, s
|
|||
|
||||
srt_source_ = NULL;
|
||||
req_ = new SrsRequest();
|
||||
mode_ = SrtModePull;
|
||||
}
|
||||
|
||||
SrsMpegtsSrtConn::~SrsMpegtsSrtConn()
|
||||
|
@ -239,29 +238,6 @@ srs_error_t SrsMpegtsSrtConn::do_cycle()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if ((err = fetch_or_create_source()) != srs_success) {
|
||||
return srs_error_wrap(err, "fetch or create srt source");
|
||||
}
|
||||
|
||||
if ((err = http_hooks_on_connect()) != srs_success) {
|
||||
return srs_error_wrap(err, "on connect");
|
||||
}
|
||||
|
||||
if (mode_ == SrtModePush) {
|
||||
err = publishing();
|
||||
} else if (mode_ == SrtModePull) {
|
||||
err = playing();
|
||||
}
|
||||
|
||||
http_hooks_on_close();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsMpegtsSrtConn::fetch_or_create_source()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
string streamid = "";
|
||||
if ((err = srs_srt_get_streamid(srt_fd_, streamid)) != srs_success) {
|
||||
return srs_error_wrap(err, "get srt streamid");
|
||||
|
@ -273,7 +249,8 @@ srs_error_t SrsMpegtsSrtConn::fetch_or_create_source()
|
|||
}
|
||||
|
||||
// Detect streamid of srt to request.
|
||||
if (! srs_srt_streamid_to_request(streamid, mode_, req_)) {
|
||||
SrtMode mode = SrtModePull;
|
||||
if (! srs_srt_streamid_to_request(streamid, mode, req_)) {
|
||||
return srs_error_new(ERROR_SRT_CONN, "invalid srt streamid=%s", streamid.c_str());
|
||||
}
|
||||
|
||||
|
@ -288,6 +265,18 @@ srs_error_t SrsMpegtsSrtConn::fetch_or_create_source()
|
|||
return srs_error_wrap(err, "fetch srt source");
|
||||
}
|
||||
|
||||
if ((err = http_hooks_on_connect()) != srs_success) {
|
||||
return srs_error_wrap(err, "on connect");
|
||||
}
|
||||
|
||||
if (mode == SrtModePush) {
|
||||
err = publishing();
|
||||
} else if (mode == SrtModePull) {
|
||||
err = playing();
|
||||
}
|
||||
|
||||
http_hooks_on_close();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ public:
|
|||
protected:
|
||||
virtual srs_error_t do_cycle();
|
||||
private:
|
||||
srs_error_t fetch_or_create_source();
|
||||
srs_error_t publishing();
|
||||
srs_error_t playing();
|
||||
srs_error_t acquire_publish();
|
||||
|
@ -120,7 +119,6 @@ private:
|
|||
SrsCoroutine* trd_;
|
||||
|
||||
SrsRequest* req_;
|
||||
SrtMode mode_;
|
||||
SrsSrtSource* srt_source_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue