mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine code, rename SrsRtmp to SrsRtmpServer.
This commit is contained in:
parent
4f91cae377
commit
8aedc51a2f
7 changed files with 58 additions and 42 deletions
|
@ -43,7 +43,7 @@ SrsBandwidth::~SrsBandwidth()
|
|||
{
|
||||
}
|
||||
|
||||
int SrsBandwidth::bandwidth_test(SrsRequest* _req, st_netfd_t stfd, SrsRtmp* _rtmp)
|
||||
int SrsBandwidth::bandwidth_test(SrsRequest* _req, st_netfd_t stfd, SrsRtmpServer* _rtmp)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_core_st.hpp>
|
||||
|
||||
class SrsRequest;
|
||||
class SrsRtmp;
|
||||
class SrsRtmpServer;
|
||||
|
||||
/**
|
||||
* bandwidth test agent which provides the interfaces for bandwidth check.
|
||||
|
@ -74,7 +74,7 @@ class SrsBandwidth
|
|||
{
|
||||
private:
|
||||
SrsRequest* req;
|
||||
SrsRtmp* rtmp;
|
||||
SrsRtmpServer* rtmp;
|
||||
public:
|
||||
SrsBandwidth();
|
||||
virtual ~SrsBandwidth();
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
/**
|
||||
* do the bandwidth test.
|
||||
*/
|
||||
virtual int bandwidth_test(SrsRequest* _req, st_netfd_t stfd, SrsRtmp* _rtmp);
|
||||
virtual int bandwidth_test(SrsRequest* _req, st_netfd_t stfd, SrsRtmpServer* _rtmp);
|
||||
private:
|
||||
virtual int get_local_ip(st_netfd_t stfd, char *&local_ip);
|
||||
/**
|
||||
|
|
|
@ -50,7 +50,7 @@ SrsClient::SrsClient(SrsServer* srs_server, st_netfd_t client_stfd)
|
|||
req = new SrsRequest();
|
||||
res = new SrsResponse();
|
||||
skt = new SrsSocket(client_stfd);
|
||||
rtmp = new SrsRtmp(skt);
|
||||
rtmp = new SrsRtmpServer(skt);
|
||||
refer = new SrsRefer();
|
||||
#ifdef SRS_HTTP
|
||||
http_hooks = new SrsHttpHooks();
|
||||
|
|
|
@ -34,7 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_core_conn.hpp>
|
||||
#include <srs_core_reload.hpp>
|
||||
|
||||
class SrsRtmp;
|
||||
class SrsRtmpServer;
|
||||
class SrsRequest;
|
||||
class SrsResponse;
|
||||
class SrsSource;
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
SrsRequest* req;
|
||||
SrsResponse* res;
|
||||
SrsSocket* skt;
|
||||
SrsRtmp* rtmp;
|
||||
SrsRtmpServer* rtmp;
|
||||
SrsRefer* refer;
|
||||
#ifdef SRS_HTTP
|
||||
SrsHttpHooks* http_hooks;
|
||||
|
|
|
@ -206,7 +206,23 @@ int srs_complex_handshake(srs_rtmp_t rtmp)
|
|||
|
||||
int srs_connect_app(srs_rtmp_t rtmp)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_assert(rtmp != NULL);
|
||||
Context* context = (Context*)rtmp;
|
||||
|
||||
string tcUrl = "rtmp://";
|
||||
tcUrl += context->vhost;
|
||||
tcUrl += ":";
|
||||
tcUrl += context->port;
|
||||
tcUrl += "/";
|
||||
tcUrl += context->app;
|
||||
|
||||
if ((ret = context->rtmp->connect_app(context->app, tcUrl)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int srs_play_stream(srs_rtmp_t rtmp)
|
||||
|
|
|
@ -441,73 +441,73 @@ int SrsRtmpClient::publish(string stream, int stream_id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
SrsRtmp::SrsRtmp(ISrsProtocolReaderWriter* skt)
|
||||
SrsRtmpServer::SrsRtmpServer(ISrsProtocolReaderWriter* skt)
|
||||
{
|
||||
io = skt;
|
||||
protocol = new SrsProtocol(skt);
|
||||
}
|
||||
|
||||
SrsRtmp::~SrsRtmp()
|
||||
SrsRtmpServer::~SrsRtmpServer()
|
||||
{
|
||||
srs_freep(protocol);
|
||||
}
|
||||
|
||||
SrsProtocol* SrsRtmp::get_protocol()
|
||||
SrsProtocol* SrsRtmpServer::get_protocol()
|
||||
{
|
||||
return protocol;
|
||||
}
|
||||
|
||||
void SrsRtmp::set_recv_timeout(int64_t timeout_us)
|
||||
void SrsRtmpServer::set_recv_timeout(int64_t timeout_us)
|
||||
{
|
||||
protocol->set_recv_timeout(timeout_us);
|
||||
}
|
||||
|
||||
int64_t SrsRtmp::get_recv_timeout()
|
||||
int64_t SrsRtmpServer::get_recv_timeout()
|
||||
{
|
||||
return protocol->get_recv_timeout();
|
||||
}
|
||||
|
||||
void SrsRtmp::set_send_timeout(int64_t timeout_us)
|
||||
void SrsRtmpServer::set_send_timeout(int64_t timeout_us)
|
||||
{
|
||||
protocol->set_send_timeout(timeout_us);
|
||||
}
|
||||
|
||||
int64_t SrsRtmp::get_send_timeout()
|
||||
int64_t SrsRtmpServer::get_send_timeout()
|
||||
{
|
||||
return protocol->get_send_timeout();
|
||||
}
|
||||
|
||||
int64_t SrsRtmp::get_recv_bytes()
|
||||
int64_t SrsRtmpServer::get_recv_bytes()
|
||||
{
|
||||
return protocol->get_recv_bytes();
|
||||
}
|
||||
|
||||
int64_t SrsRtmp::get_send_bytes()
|
||||
int64_t SrsRtmpServer::get_send_bytes()
|
||||
{
|
||||
return protocol->get_send_bytes();
|
||||
}
|
||||
|
||||
int SrsRtmp::get_recv_kbps()
|
||||
int SrsRtmpServer::get_recv_kbps()
|
||||
{
|
||||
return protocol->get_recv_kbps();
|
||||
}
|
||||
|
||||
int SrsRtmp::get_send_kbps()
|
||||
int SrsRtmpServer::get_send_kbps()
|
||||
{
|
||||
return protocol->get_send_kbps();
|
||||
}
|
||||
|
||||
int SrsRtmp::recv_message(SrsCommonMessage** pmsg)
|
||||
int SrsRtmpServer::recv_message(SrsCommonMessage** pmsg)
|
||||
{
|
||||
return protocol->recv_message(pmsg);
|
||||
}
|
||||
|
||||
int SrsRtmp::send_message(ISrsMessage* msg)
|
||||
int SrsRtmpServer::send_message(ISrsMessage* msg)
|
||||
{
|
||||
return protocol->send_message(msg);
|
||||
}
|
||||
|
||||
int SrsRtmp::handshake()
|
||||
int SrsRtmpServer::handshake()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -520,7 +520,7 @@ int SrsRtmp::handshake()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::connect_app(SrsRequest* req)
|
||||
int SrsRtmpServer::connect_app(SrsRequest* req)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -559,7 +559,7 @@ int SrsRtmp::connect_app(SrsRequest* req)
|
|||
return req->discovery_app();
|
||||
}
|
||||
|
||||
int SrsRtmp::set_window_ack_size(int ack_size)
|
||||
int SrsRtmpServer::set_window_ack_size(int ack_size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -578,7 +578,7 @@ int SrsRtmp::set_window_ack_size(int ack_size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::set_peer_bandwidth(int bandwidth, int type)
|
||||
int SrsRtmpServer::set_peer_bandwidth(int bandwidth, int type)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -599,7 +599,7 @@ int SrsRtmp::set_peer_bandwidth(int bandwidth, int type)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::response_connect_app(SrsRequest *req, const char* server_ip)
|
||||
int SrsRtmpServer::response_connect_app(SrsRequest *req, const char* server_ip)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -644,7 +644,7 @@ int SrsRtmp::response_connect_app(SrsRequest *req, const char* server_ip)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void SrsRtmp::response_connect_reject(SrsRequest *req, const char* desc)
|
||||
void SrsRtmpServer::response_connect_reject(SrsRequest *req, const char* desc)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -665,7 +665,7 @@ void SrsRtmp::response_connect_reject(SrsRequest *req, const char* desc)
|
|||
return;
|
||||
}
|
||||
|
||||
int SrsRtmp::on_bw_done()
|
||||
int SrsRtmpServer::on_bw_done()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -683,7 +683,7 @@ int SrsRtmp::on_bw_done()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::identify_client(int stream_id, SrsClientType& type, string& stream_name)
|
||||
int SrsRtmpServer::identify_client(int stream_id, SrsClientType& type, string& stream_name)
|
||||
{
|
||||
type = SrsClientUnknown;
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
@ -728,7 +728,7 @@ int SrsRtmp::identify_client(int stream_id, SrsClientType& type, string& stream_
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::set_chunk_size(int chunk_size)
|
||||
int SrsRtmpServer::set_chunk_size(int chunk_size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -747,7 +747,7 @@ int SrsRtmp::set_chunk_size(int chunk_size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::start_play(int stream_id)
|
||||
int SrsRtmpServer::start_play(int stream_id)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -842,7 +842,7 @@ int SrsRtmp::start_play(int stream_id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::on_play_client_pause(int stream_id, bool is_pause)
|
||||
int SrsRtmpServer::on_play_client_pause(int stream_id, bool is_pause)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -917,7 +917,7 @@ int SrsRtmp::on_play_client_pause(int stream_id, bool is_pause)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::start_fmle_publish(int stream_id)
|
||||
int SrsRtmpServer::start_fmle_publish(int stream_id)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ int SrsRtmp::start_fmle_publish(int stream_id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::fmle_unpublish(int stream_id, double unpublish_tid)
|
||||
int SrsRtmpServer::fmle_unpublish(int stream_id, double unpublish_tid)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ int SrsRtmp::fmle_unpublish(int stream_id, double unpublish_tid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::start_flash_publish(int stream_id)
|
||||
int SrsRtmpServer::start_flash_publish(int stream_id)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ int SrsRtmp::start_flash_publish(int stream_id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsClientType& type, string& stream_name)
|
||||
int SrsRtmpServer::identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsClientType& type, string& stream_name)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ int SrsRtmp::identify_create_stream_client(SrsCreateStreamPacket* req, int strea
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClientType& type, string& stream_name)
|
||||
int SrsRtmpServer::identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClientType& type, string& stream_name)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ int SrsRtmp::identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClientType
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::identify_flash_publish_client(SrsPublishPacket* req, SrsClientType& type, string& stream_name)
|
||||
int SrsRtmpServer::identify_flash_publish_client(SrsPublishPacket* req, SrsClientType& type, string& stream_name)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ int SrsRtmp::identify_flash_publish_client(SrsPublishPacket* req, SrsClientType&
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsRtmp::identify_play_client(SrsPlayPacket* req, SrsClientType& type, string& stream_name)
|
||||
int SrsRtmpServer::identify_play_client(SrsPlayPacket* req, SrsClientType& type, string& stream_name)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
|
|
@ -146,14 +146,14 @@ public:
|
|||
* such as connect to vhost/app, play stream, get audio/video data.
|
||||
*/
|
||||
// TODO: FIXME: rename to SrsRtmpServer
|
||||
class SrsRtmp
|
||||
class SrsRtmpServer
|
||||
{
|
||||
private:
|
||||
SrsProtocol* protocol;
|
||||
ISrsProtocolReaderWriter* io;
|
||||
public:
|
||||
SrsRtmp(ISrsProtocolReaderWriter* skt);
|
||||
virtual ~SrsRtmp();
|
||||
SrsRtmpServer(ISrsProtocolReaderWriter* skt);
|
||||
virtual ~SrsRtmpServer();
|
||||
public:
|
||||
virtual SrsProtocol* get_protocol();
|
||||
virtual void set_recv_timeout(int64_t timeout_us);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue