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

for #250, add mpegts over udp stream caster class.

This commit is contained in:
winlin 2015-01-24 16:27:30 +08:00
parent 7f02bfa3a4
commit 6463d22a14
8 changed files with 148 additions and 29 deletions

View file

@ -44,7 +44,10 @@ class SrsHttpServer;
class SrsIngester;
class SrsHttpHeartbeat;
class SrsKbps;
class sockaddr_in;
class SrsConfDirective;
#ifdef SRS_AUTO_STREAM_CASTER
class SrsMpegtsOverUdp;
#endif
// listener type for server to identify the connection,
// that is, use different type to process the connection.
@ -84,6 +87,7 @@ public:
virtual int cycle();
};
#ifdef SRS_AUTO_STREAM_CASTER
/**
* the udp listener, for udp server.
*/
@ -92,8 +96,9 @@ class SrsUdpListener : public SrsListener
private:
char* buf;
int nb_buf;
SrsMpegtsOverUdp* caster;
public:
SrsUdpListener(SrsServer* server, SrsListenerType type);
SrsUdpListener(SrsServer* server, SrsListenerType type, SrsConfDirective* c);
virtual ~SrsUdpListener();
public:
virtual int listen(int port);
@ -101,6 +106,7 @@ public:
public:
virtual int cycle();
};
#endif
/**
* convert signal to io,
@ -256,16 +262,6 @@ public:
* @param client_stfd, the client fd in st boxed, the underlayer fd.
*/
virtual int accept_client(SrsListenerType type, st_netfd_t client_stfd);
/**
* when udp listener got a udp packet, notice server to process it.
* @param type, the client type, used to create concrete connection,
* for instance RTMP connection to serve client.
* @param from, the udp packet from address.
* @param buf, the udp packet bytes, user should copy if need to use.
* @param nb_buf, the size of udp packet bytes.
* @remark user should never use the buf, for it's a shared memory bytes.
*/
virtual int on_udp_packet(SrsListenerType type, sockaddr_in* from, char* buf, int nb_buf);
// interface ISrsThreadHandler.
public:
virtual int on_reload_listen();