wenjiegit

merge upstream

正在显示 50 个修改的文件 包含 40 行增加496 行删除
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -34,7 +33,7 @@ static int64_t _srs_system_time_us_cache = 0; @@ -34,7 +33,7 @@ static int64_t _srs_system_time_us_cache = 0;
34 33
35 int64_t srs_get_system_time_ms() 34 int64_t srs_get_system_time_ms()
36 { 35 {
37 - return _srs_system_time_us_cache / 1000; 36 + return _srs_system_time_us_cache / 1000;
38 } 37 }
39 38
40 void srs_update_system_time_ms() 39 void srs_update_system_time_ms()
@@ -104,13 +103,13 @@ void srs_vhost_resolve(std::string& vhost, std::string& app) @@ -104,13 +103,13 @@ void srs_vhost_resolve(std::string& vhost, std::string& app)
104 if ((pos = query.find("vhost?")) != std::string::npos 103 if ((pos = query.find("vhost?")) != std::string::npos
105 || (pos = query.find("vhost=")) != std::string::npos 104 || (pos = query.find("vhost=")) != std::string::npos
106 || (pos = query.find("Vhost?")) != std::string::npos 105 || (pos = query.find("Vhost?")) != std::string::npos
107 - || (pos = query.find("Vhost=")) != std::string::npos)  
108 - { 106 + || (pos = query.find("Vhost=")) != std::string::npos
  107 + ) {
109 query = query.substr(pos + 6); 108 query = query.substr(pos + 6);
110 if (!query.empty()) { 109 if (!query.empty()) {
111 vhost = query; 110 vhost = query;
112 } 111 }
113 - } 112 + }
114 } 113 }
115 114
116 void srs_close_stfd(st_netfd_t& stfd) 115 void srs_close_stfd(st_netfd_t& stfd)
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -119,4 +118,4 @@ extern void srs_close_stfd(st_netfd_t& stfd); @@ -119,4 +118,4 @@ extern void srs_close_stfd(st_netfd_t& stfd);
119 className(const className&); \ 118 className(const className&); \
120 className& operator= (const className&) 119 className& operator= (const className&)
121 120
122 -#endif 121 +#endif
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -144,8 +143,8 @@ int SrsClient::on_reload_vhost_removed(string vhost) @@ -144,8 +143,8 @@ int SrsClient::on_reload_vhost_removed(string vhost)
144 int SrsClient::service_cycle() 143 int SrsClient::service_cycle()
145 { 144 {
146 int ret = ERROR_SUCCESS; 145 int ret = ERROR_SUCCESS;
147 -  
148 - if ((ret = rtmp->set_window_ack_size(2.5 * 1000 * 1000)) != ERROR_SUCCESS) { 146 +
  147 + if ((ret = rtmp->set_window_ack_size(2.5 * 1000 * 1000)) != ERROR_SUCCESS) {
149 srs_error("set window acknowledgement size failed. ret=%d", ret); 148 srs_error("set window acknowledgement size failed. ret=%d", ret);
150 return ret; 149 return ret;
151 } 150 }
@@ -166,20 +165,19 @@ int SrsClient::service_cycle() @@ -166,20 +165,19 @@ int SrsClient::service_cycle()
166 srs_error("response connect app failed. ret=%d", ret); 165 srs_error("response connect app failed. ret=%d", ret);
167 return ret; 166 return ret;
168 } 167 }
169 - srs_verbose("response connect app success"); 168 + srs_verbose("response connect app success");
170 169
171 if ((ret = rtmp->on_bw_done()) != ERROR_SUCCESS) { 170 if ((ret = rtmp->on_bw_done()) != ERROR_SUCCESS) {
172 srs_error("on_bw_done failed. ret=%d", ret); 171 srs_error("on_bw_done failed. ret=%d", ret);
173 return ret; 172 return ret;
174 } 173 }
175 srs_verbose("on_bw_done success"); 174 srs_verbose("on_bw_done success");
176 -  
177 - SrsClientType type;  
178 - if ((ret = rtmp->identify_client(res->stream_id, type, req->stream)) != ERROR_SUCCESS) {  
179 - srs_error("identify client failed. ret=%d", ret);  
180 - return ret;  
181 - }  
182 - 175 +
  176 + SrsClientType type;
  177 + if ((ret = rtmp->identify_client(res->stream_id, type, req->stream)) != ERROR_SUCCESS) {
  178 + srs_error("identify client failed. ret=%d", ret);
  179 + return ret;
  180 + }
183 req->strip(); 181 req->strip();
184 srs_trace("identify client success. type=%d, stream_name=%s", type, req->stream.c_str()); 182 srs_trace("identify client success. type=%d, stream_name=%s", type, req->stream.c_str());
185 183
@@ -541,40 +539,6 @@ int SrsClient::get_peer_ip() @@ -541,40 +539,6 @@ int SrsClient::get_peer_ip()
541 return ret; 539 return ret;
542 } 540 }
543 541
544 -int SrsClient::get_local_ip(char *&local_ip)  
545 -{  
546 - int ret = ERROR_SUCCESS;  
547 -  
548 - int fd = st_netfd_fileno(stfd);  
549 -  
550 - // discovery client information  
551 - sockaddr_in addr;  
552 - socklen_t addrlen = sizeof(addr);  
553 - if (getsockname(fd, (sockaddr*)&addr, &addrlen) == -1) {  
554 - ret = ERROR_SOCKET_GET_LOCAL_IP;  
555 - srs_error("discovery local ip information failed. ret=%d", ret);  
556 - return ret;  
557 - }  
558 - srs_verbose("get local ip success.");  
559 -  
560 - // ip v4 or v6  
561 - char buf[INET6_ADDRSTRLEN];  
562 - memset(buf, 0, sizeof(buf));  
563 -  
564 - if ((inet_ntop(addr.sin_family, &addr.sin_addr, buf, sizeof(buf))) == NULL) {  
565 - ret = ERROR_SOCKET_GET_LOCAL_IP;  
566 - srs_error("convert local ip information failed. ret=%d", ret);  
567 - return ret;  
568 - }  
569 -  
570 - local_ip = new char[strlen(buf) + 1];  
571 - strcpy(local_ip, buf);  
572 -  
573 - srs_verbose("get local ip of client ip=%s, fd=%d", buf, fd);  
574 -  
575 - return ret;  
576 -}  
577 -  
578 int SrsClient::process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg) 542 int SrsClient::process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg)
579 { 543 {
580 int ret = ERROR_SUCCESS; 544 int ret = ERROR_SUCCESS;
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -77,7 +76,6 @@ private: @@ -77,7 +76,6 @@ private:
77 virtual int publish(SrsSource* source, bool is_fmle); 76 virtual int publish(SrsSource* source, bool is_fmle);
78 virtual int process_publish_message(SrsSource* source, SrsCommonMessage* msg, bool is_fmle); 77 virtual int process_publish_message(SrsSource* source, SrsCommonMessage* msg, bool is_fmle);
79 virtual int get_peer_ip(); 78 virtual int get_peer_ip();
80 - virtual int get_local_ip(char *&local_ip);  
81 virtual int process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg); 79 virtual int process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg);
82 private: 80 private:
83 virtual int on_connect(); 81 virtual int on_connect();
@@ -88,4 +86,4 @@ private: @@ -88,4 +86,4 @@ private:
88 virtual void on_stop(); 86 virtual void on_stop();
89 }; 87 };
90 88
91 -#endif 89 +#endif
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -1508,61 +1507,7 @@ int SrsConfig::get_pithy_print_hls() @@ -1508,61 +1507,7 @@ int SrsConfig::get_pithy_print_hls()
1508 return SRS_STAGE_HLS_INTERVAL_MS; 1507 return SRS_STAGE_HLS_INTERVAL_MS;
1509 } 1508 }
1510 1509
1511 - return ::atoi(pithy->arg0().c_str());  
1512 -}  
1513 -  
1514 -bool SrsConfig::get_bw_check_enabled(const std::string &vhost, const std::string &key)  
1515 -{  
1516 - SrsConfDirective* conf = get_vhost(vhost);  
1517 -  
1518 - if (!conf) {  
1519 - return false;  
1520 - }  
1521 -  
1522 - SrsConfDirective* bw_test = conf->get("bandcheck");  
1523 - if(!bw_test)  
1524 - return false;  
1525 -  
1526 - SrsConfDirective* bw_enabled_conf = bw_test->get("enabled");  
1527 - if(bw_enabled_conf && bw_enabled_conf->arg0() == "on"){  
1528 - SrsConfDirective* bw_key = bw_test->get("key");  
1529 - if(!bw_key) return false;  
1530 -  
1531 - std::vector<std::string> &args = bw_key->args;  
1532 - for(unsigned int i = 0; i < args.size(); ++i){  
1533 - if(args.at(i) == key)  
1534 - return true;  
1535 - }  
1536 - }  
1537 -  
1538 - return false;  
1539 -}  
1540 -  
1541 -void SrsConfig::get_bw_check_settings(const std::string &vhost, int64_t &interval_ms, int &limit_kbps)  
1542 -{  
1543 - // set default value;  
1544 - interval_ms = 30 * 1000;  
1545 - limit_kbps = 32000;  
1546 -  
1547 - SrsConfDirective* conf = get_vhost(vhost);  
1548 - if (!conf) {  
1549 - return;  
1550 - }  
1551 -  
1552 - SrsConfDirective* bw_test = conf->get("bandcheck");  
1553 - if (!bw_test) {  
1554 - return;  
1555 - }  
1556 -  
1557 - SrsConfDirective* interval_conf = bw_test->get("interval");  
1558 - if (interval_conf) {  
1559 - interval_ms = ::atoll(interval_conf->arg0().c_str()) * 1000;  
1560 - }  
1561 -  
1562 - SrsConfDirective* limit_kbps_conf = bw_test->get("limit_kbps");  
1563 - if (limit_kbps_conf) {  
1564 - limit_kbps = ::atoi(limit_kbps_conf->arg0().c_str());  
1565 - } 1510 + return ::atoi(pithy->arg0().c_str());
1566 } 1511 }
1567 1512
1568 bool SrsConfig::get_bw_check_enabled(const string &vhost) 1513 bool SrsConfig::get_bw_check_enabled(const string &vhost)
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -116,7 +115,6 @@ public: @@ -116,7 +115,6 @@ public:
116 virtual void unsubscribe(ISrsReloadHandler* handler); 115 virtual void unsubscribe(ISrsReloadHandler* handler);
117 public: 116 public:
118 virtual int parse_options(int argc, char** argv); 117 virtual int parse_options(int argc, char** argv);
119 -  
120 private: 118 private:
121 virtual int parse_file(const char* filename); 119 virtual int parse_file(const char* filename);
122 virtual int parse_argv(int& i, char** argv); 120 virtual int parse_argv(int& i, char** argv);
@@ -188,4 +186,4 @@ bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b); @@ -188,4 +186,4 @@ bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b);
188 // global config 186 // global config
189 extern SrsConfig* config; 187 extern SrsConfig* config;
190 188
191 -#endif 189 +#endif
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -148,4 +147,4 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -148,4 +147,4 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
148 #define ERROR_HTTP_DATA_INVLIAD 801 147 #define ERROR_HTTP_DATA_INVLIAD 801
149 #define ERROR_HTTP_PARSE_HEADER 802 148 #define ERROR_HTTP_PARSE_HEADER 802
150 149
151 -#endif 150 +#endif
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -1177,12 +1176,7 @@ bool SrsMessageHeader::is_set_chunk_size() @@ -1177,12 +1176,7 @@ bool SrsMessageHeader::is_set_chunk_size()
1177 1176
1178 bool SrsMessageHeader::is_user_control_message() 1177 bool SrsMessageHeader::is_user_control_message()
1179 { 1178 {
1180 - return message_type == RTMP_MSG_UserControlMessage;  
1181 -}  
1182 -  
1183 -bool SrsMessageHeader::is_windows_ackledgement()  
1184 -{  
1185 - return message_type == RTMP_MSG_Acknowledgement; 1179 + return message_type == RTMP_MSG_UserControlMessage;
1186 } 1180 }
1187 1181
1188 SrsChunkStream::SrsChunkStream(int _cid) 1182 SrsChunkStream::SrsChunkStream(int _cid)
@@ -1389,7 +1383,7 @@ int SrsCommonMessage::decode_packet(SrsProtocol* protocol) @@ -1389,7 +1383,7 @@ int SrsCommonMessage::decode_packet(SrsProtocol* protocol)
1389 srs_verbose("start to decode set chunk size message."); 1383 srs_verbose("start to decode set chunk size message.");
1390 packet = new SrsSetChunkSizePacket(); 1384 packet = new SrsSetChunkSizePacket();
1391 return packet->decode(stream); 1385 return packet->decode(stream);
1392 - } else { 1386 + } else {
1393 // default packet to drop message. 1387 // default packet to drop message.
1394 srs_trace("drop the unknown message, type=%d", header.message_type); 1388 srs_trace("drop the unknown message, type=%d", header.message_type);
1395 packet = new SrsPacket(); 1389 packet = new SrsPacket();
@@ -2614,31 +2608,7 @@ SrsOnStatusCallPacket::SrsOnStatusCallPacket() @@ -2614,31 +2608,7 @@ SrsOnStatusCallPacket::SrsOnStatusCallPacket()
2614 SrsOnStatusCallPacket::~SrsOnStatusCallPacket() 2608 SrsOnStatusCallPacket::~SrsOnStatusCallPacket()
2615 { 2609 {
2616 srs_freep(args); 2610 srs_freep(args);
2617 - srs_freep(data);  
2618 -}  
2619 -  
2620 -int SrsOnStatusCallPacket::decode(SrsStream *stream)  
2621 -{  
2622 - int ret = ERROR_SUCCESS;  
2623 -  
2624 - if ((ret = srs_amf0_read_string(stream, command_name)) != ERROR_SUCCESS) {  
2625 - srs_error("amf0 decode play command_name failed. ret=%d", ret);  
2626 - return ret;  
2627 - }  
2628 -  
2629 - if ((ret = srs_amf0_read_number(stream, transaction_id)) != ERROR_SUCCESS) {  
2630 - srs_error("amf0 decode play transaction_id failed. ret=%d", ret);  
2631 - return ret;  
2632 - }  
2633 -  
2634 - if ((ret = srs_amf0_read_null(stream)) != ERROR_SUCCESS) {  
2635 - srs_error("amf0 decode play command_object failed. ret=%d", ret);  
2636 - return ret;  
2637 - }  
2638 -  
2639 - srs_info("decode SrsOnStatusCallPacket success.");  
2640 -  
2641 - return ret; 2611 + srs_freep(data);
2642 } 2612 }
2643 2613
2644 int SrsOnStatusCallPacket::get_perfer_cid() 2614 int SrsOnStatusCallPacket::get_perfer_cid()
@@ -3111,14 +3081,6 @@ SrsAcknowledgementPacket::~SrsAcknowledgementPacket() @@ -3111,14 +3081,6 @@ SrsAcknowledgementPacket::~SrsAcknowledgementPacket()
3111 { 3081 {
3112 } 3082 }
3113 3083
3114 -int SrsAcknowledgementPacket::decode(SrsStream *stream)  
3115 -{  
3116 - int ret = ERROR_SUCCESS;  
3117 - ret = sequence_number = stream->read_4bytes();  
3118 -  
3119 - return ret;  
3120 -}  
3121 -  
3122 int SrsAcknowledgementPacket::get_perfer_cid() 3084 int SrsAcknowledgementPacket::get_perfer_cid()
3123 { 3085 {
3124 return RTMP_CID_ProtocolControl; 3086 return RTMP_CID_ProtocolControl;
@@ -3344,3 +3306,4 @@ int SrsUserControlPacket::encode_packet(SrsStream* stream) @@ -3344,3 +3306,4 @@ int SrsUserControlPacket::encode_packet(SrsStream* stream)
3344 3306
3345 return ret; 3307 return ret;
3346 } 3308 }
  3309 +
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -68,25 +67,6 @@ class ISrsMessage; @@ -68,25 +67,6 @@ class ISrsMessage;
68 #define RTMP_MAX_FMT3_HEADER_SIZE 5 67 #define RTMP_MAX_FMT3_HEADER_SIZE 5
69 68
70 /** 69 /**
71 -* band width check method name, which will be invoked by client.  
72 -* band width check mothods use SrsOnStatusCallPacket as its internal packet type,  
73 -* so ensure you set command name when you use it.  
74 -*/  
75 -// for play  
76 -#define SRS_BW_CHECK_START_PLAY "onSrsBandCheckStartPlayBytes"  
77 -#define SRS_BW_CHECK_STARTING_PLAY "onSrsBandCheckStartingPlayBytes"  
78 -#define SRS_BW_CHECK_STOP_PLAY "onSrsBandCheckStopPlayBytes"  
79 -#define SRS_BW_CHECK_STOPPED_PLAY "onSrsBandCheckStoppedPlayBytes"  
80 -#define SRS_BW_CHECK_PLAYING "onSrsBandCheckPlaying"  
81 -  
82 -// for publish  
83 -#define SRS_BW_CHECK_START_PUBLISH "onSrsBandCheckStartPublishBytes"  
84 -#define SRS_BW_CHECK_STARTING_PUBLISH "onSrsBandCheckStartingPublishBytes"  
85 -#define SRS_BW_CHECK_STOP_PUBLISH "onSrsBandCheckStopPublishBytes"  
86 -#define SRS_BW_CHECK_FINISHED "onSrsBandCheckFinished"  
87 -#define SRS_BW_CHECK_PUBLISHING "onSrsBandCheckPublishing"  
88 -  
89 -/**  
90 * the protocol provides the rtmp-message-protocol services, 70 * the protocol provides the rtmp-message-protocol services,
91 * to recv RTMP message from RTMP chunk stream, 71 * to recv RTMP message from RTMP chunk stream,
92 * and to send out RTMP message over RTMP chunk stream. 72 * and to send out RTMP message over RTMP chunk stream.
@@ -240,7 +220,6 @@ struct SrsMessageHeader @@ -240,7 +220,6 @@ struct SrsMessageHeader
240 bool is_window_ackledgement_size(); 220 bool is_window_ackledgement_size();
241 bool is_set_chunk_size(); 221 bool is_set_chunk_size();
242 bool is_user_control_message(); 222 bool is_user_control_message();
243 - bool is_windows_ackledgement();  
244 }; 223 };
245 224
246 /** 225 /**
@@ -845,10 +824,6 @@ public: @@ -845,10 +824,6 @@ public:
845 public: 824 public:
846 SrsOnStatusCallPacket(); 825 SrsOnStatusCallPacket();
847 virtual ~SrsOnStatusCallPacket(); 826 virtual ~SrsOnStatusCallPacket();
848 -  
849 -public:  
850 - virtual int decode(SrsStream* stream);  
851 -  
852 public: 827 public:
853 virtual int get_perfer_cid(); 828 virtual int get_perfer_cid();
854 public: 829 public:
@@ -1044,10 +1019,6 @@ public: @@ -1044,10 +1019,6 @@ public:
1044 public: 1019 public:
1045 SrsAcknowledgementPacket(); 1020 SrsAcknowledgementPacket();
1046 virtual ~SrsAcknowledgementPacket(); 1021 virtual ~SrsAcknowledgementPacket();
1047 -  
1048 -public:  
1049 - virtual int decode(SrsStream *stream);  
1050 -  
1051 public: 1022 public:
1052 virtual int get_perfer_cid(); 1023 virtual int get_perfer_cid();
1053 public: 1024 public:
@@ -1221,4 +1192,4 @@ int srs_rtmp_expect_message(SrsProtocol* protocol, SrsCommonMessage** pmsg, T** @@ -1221,4 +1192,4 @@ int srs_rtmp_expect_message(SrsProtocol* protocol, SrsCommonMessage** pmsg, T**
1221 return ret; 1192 return ret;
1222 } 1193 }
1223 1194
1224 -#endif 1195 +#endif
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiejit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -73,8 +72,8 @@ using namespace std; @@ -73,8 +72,8 @@ using namespace std;
73 #define SRS_DEFAULT_SID 1 72 #define SRS_DEFAULT_SID 1
74 73
75 SrsRequest::SrsRequest() 74 SrsRequest::SrsRequest()
76 - : objectEncoding(RTMP_SIG_AMF0_VER)  
77 { 75 {
  76 + objectEncoding = RTMP_SIG_AMF0_VER;
78 } 77 }
79 78
80 SrsRequest::~SrsRequest() 79 SrsRequest::~SrsRequest()
@@ -122,25 +121,12 @@ int SrsRequest::discovery_app() @@ -122,25 +121,12 @@ int SrsRequest::discovery_app()
122 port = vhost.substr(pos + 1); 121 port = vhost.substr(pos + 1);
123 vhost = vhost.substr(0, pos); 122 vhost = vhost.substr(0, pos);
124 srs_verbose("discovery vhost=%s, port=%s", vhost.c_str(), port.c_str()); 123 srs_verbose("discovery vhost=%s, port=%s", vhost.c_str(), port.c_str());
125 - }  
126 - 124 + }
  125 +
127 app = url; 126 app = url;
128 srs_vhost_resolve(vhost, app); 127 srs_vhost_resolve(vhost, app);
129 -  
130 - // reslove bw check key  
131 - std::string app_str = url;  
132 - if ((pos = app_str.find("key=")) != std::string::npos){  
133 - std::string temp_key = app_str.substr(pos + strlen("key="));  
134 - for(unsigned int i = 0; i < temp_key.size(); ++i){  
135 - char c = temp_key[i];  
136 - if(c != '&')  
137 - bw_key.push_back(c);  
138 - else break;  
139 - }  
140 - }  
141 -  
142 strip(); 128 strip();
143 - 129 +
144 // resolve the vhost from config 130 // resolve the vhost from config
145 SrsConfDirective* parsed_vhost = config->get_vhost(vhost); 131 SrsConfDirective* parsed_vhost = config->get_vhost(vhost);
146 if (parsed_vhost) { 132 if (parsed_vhost) {
@@ -280,7 +266,7 @@ int SrsRtmpClient::handshake() @@ -280,7 +266,7 @@ int SrsRtmpClient::handshake()
280 return ret; 266 return ret;
281 } 267 }
282 268
283 -int SrsRtmpClient::connect_app(const std::string &app, const std::string &tc_url) 269 +int SrsRtmpClient::connect_app(string app, string tc_url)
284 { 270 {
285 int ret = ERROR_SUCCESS; 271 int ret = ERROR_SUCCESS;
286 272
@@ -366,7 +352,7 @@ int SrsRtmpClient::create_stream(int& stream_id) @@ -366,7 +352,7 @@ int SrsRtmpClient::create_stream(int& stream_id)
366 return ret; 352 return ret;
367 } 353 }
368 354
369 -int SrsRtmpClient::play(const std::string &stream, int stream_id) 355 +int SrsRtmpClient::play(string stream, int stream_id)
370 { 356 {
371 int ret = ERROR_SUCCESS; 357 int ret = ERROR_SUCCESS;
372 358
@@ -408,7 +394,7 @@ int SrsRtmpClient::play(const std::string &stream, int stream_id) @@ -408,7 +394,7 @@ int SrsRtmpClient::play(const std::string &stream, int stream_id)
408 return ret; 394 return ret;
409 } 395 }
410 396
411 -int SrsRtmpClient::publish(const std::string &stream, int stream_id) 397 +int SrsRtmpClient::publish(string stream, int stream_id)
412 { 398 {
413 int ret = ERROR_SUCCESS; 399 int ret = ERROR_SUCCESS;
414 400
@@ -606,7 +592,7 @@ int SrsRtmp::response_connect_app(SrsRequest *req, const char* server_ip) @@ -606,7 +592,7 @@ int SrsRtmp::response_connect_app(SrsRequest *req, const char* server_ip)
606 pkt->props->set("mode", new SrsAmf0Number(1)); 592 pkt->props->set("mode", new SrsAmf0Number(1));
607 593
608 pkt->info->set(StatusLevel, new SrsAmf0String(StatusLevelStatus)); 594 pkt->info->set(StatusLevel, new SrsAmf0String(StatusLevelStatus));
609 - pkt->info->set(StatusCode, new SrsAmf0String(StatusCodeConnectSuccess)); 595 + pkt->info->set(StatusCode, new SrsAmf0String(StatusCodeConnectSuccess));
610 pkt->info->set(StatusDescription, new SrsAmf0String("Connection succeeded")); 596 pkt->info->set(StatusDescription, new SrsAmf0String("Connection succeeded"));
611 pkt->info->set("objectEncoding", new SrsAmf0Number(req->objectEncoding)); 597 pkt->info->set("objectEncoding", new SrsAmf0Number(req->objectEncoding));
612 SrsASrsAmf0EcmaArray* data = new SrsASrsAmf0EcmaArray(); 598 SrsASrsAmf0EcmaArray* data = new SrsASrsAmf0EcmaArray();
@@ -1105,60 +1091,7 @@ int SrsRtmp::start_flash_publish(int stream_id) @@ -1105,60 +1091,7 @@ int SrsRtmp::start_flash_publish(int stream_id)
1105 1091
1106 srs_info("flash publish success."); 1092 srs_info("flash publish success.");
1107 1093
1108 - return ret;  
1109 -}  
1110 -  
1111 -int SrsRtmp::start_bandwidth_check(int limit_kbps)  
1112 -{  
1113 - int ret = ERROR_SUCCESS;  
1114 -  
1115 - int play_duration_ms = 3000;  
1116 - int play_interval_ms = 0;  
1117 - int play_actual_duration_ms = 0;  
1118 - int play_bytes = 0;  
1119 -  
1120 - int publish_duration_ms = 3000;  
1121 - int publish_interval_ms = 0;  
1122 - int publish_actual_duration_ms = 0;  
1123 - int publish_bytes = 0;  
1124 -  
1125 - int64_t start_time = srs_get_system_time_ms();  
1126 - if ((ret = bandwidth_check_play(play_duration_ms, play_interval_ms,  
1127 - play_actual_duration_ms, play_bytes, limit_kbps) != ERROR_SUCCESS)  
1128 - || (ret = bandwidth_check_publish(publish_duration_ms, publish_interval_ms,  
1129 - publish_actual_duration_ms, publish_bytes, limit_kbps)) != ERROR_SUCCESS) {  
1130 -  
1131 - srs_error("band width check failed. ret = %d", ret);  
1132 -  
1133 - return ret;  
1134 - }  
1135 -  
1136 - int64_t end_time = srs_get_system_time_ms();  
1137 - int play_kbps = play_bytes * 8 / play_actual_duration_ms;  
1138 - int publish_kbps = publish_bytes * 8 / publish_actual_duration_ms;  
1139 -  
1140 - // send finished msg  
1141 - SrsCommonMessage* finish_msg = new SrsCommonMessage();  
1142 - SrsOnStatusCallPacket* finish_pkt = new SrsOnStatusCallPacket;  
1143 - finish_pkt->command_name = SRS_BW_CHECK_FINISHED;  
1144 - finish_pkt->data->set("code", new SrsAmf0Number(0));  
1145 - finish_pkt->data->set("start_time", new SrsAmf0Number(start_time));  
1146 - finish_pkt->data->set("end_time", new SrsAmf0Number(end_time));  
1147 - finish_pkt->data->set("play_kbps", new SrsAmf0Number(play_kbps));  
1148 - finish_pkt->data->set("publish_kbps", new SrsAmf0Number(publish_kbps));  
1149 - finish_pkt->data->set("play_bytes", new SrsAmf0Number(play_bytes));  
1150 - finish_pkt->data->set("play_time", new SrsAmf0Number(play_actual_duration_ms));  
1151 - finish_pkt->data->set("publish_bytes", new SrsAmf0Number(publish_bytes));  
1152 - finish_pkt->data->set("publish_time", new SrsAmf0Number(publish_actual_duration_ms));  
1153 -  
1154 - finish_msg->set_packet(finish_pkt, 0);  
1155 - if ((ret = protocol->send_message(finish_msg)) != ERROR_SUCCESS) {  
1156 - srs_error("send bandwidth check finish message failed. ret=%d", ret);  
1157 - return ret;  
1158 - }  
1159 - srs_trace("BW check finished.");  
1160 -  
1161 - return ret; 1094 + return ret;
1162 } 1095 }
1163 1096
1164 int SrsRtmp::identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsClientType& type, string& stream_name) 1097 int SrsRtmp::identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsClientType& type, string& stream_name)
@@ -1249,216 +1182,6 @@ int SrsRtmp::identify_flash_publish_client(SrsPublishPacket* req, SrsClientType& @@ -1249,216 +1182,6 @@ int SrsRtmp::identify_flash_publish_client(SrsPublishPacket* req, SrsClientType&
1249 type = SrsClientFlashPublish; 1182 type = SrsClientFlashPublish;
1250 stream_name = req->stream_name; 1183 stream_name = req->stream_name;
1251 1184
1252 - return ret;  
1253 -}  
1254 -  
1255 -int SrsRtmp::bandwidth_check_play(int duration_ms, int interval_ms, int &actual_duration_ms,  
1256 - int &play_bytes, int max_play_kbps)  
1257 -{  
1258 - int ret = ERROR_SUCCESS;  
1259 -  
1260 - // send start play command to client  
1261 - SrsCommonMessage* start_play_msg = new SrsCommonMessage();  
1262 - SrsOnStatusCallPacket* start_play_packet = new SrsOnStatusCallPacket;  
1263 - start_play_packet->command_name = SRS_BW_CHECK_START_PLAY;  
1264 - start_play_packet->data->set("duration_ms", new SrsAmf0Number(duration_ms));  
1265 - start_play_packet->data->set("interval_ms", new SrsAmf0Number(interval_ms));  
1266 -  
1267 - start_play_msg->set_packet(start_play_packet, 0);  
1268 - if ((ret = protocol->send_message(start_play_msg)) != ERROR_SUCCESS) {  
1269 - srs_error("send bandwidth check start play message failed. ret=%d", ret);  
1270 - return ret;  
1271 - }  
1272 - srs_trace("BW check begin.");  
1273 -  
1274 - // recv client's starting play response  
1275 - while (true) {  
1276 - SrsCommonMessage* msg = 0;  
1277 - if ( (ret = protocol->recv_message(&msg)) != ERROR_SUCCESS) {  
1278 - srs_error("recv client's starting play response failed. ret= %d", ret);  
1279 - return ret;  
1280 - }  
1281 -  
1282 - msg->decode_packet(protocol);  
1283 - SrsOnStatusCallPacket* pkt = dynamic_cast<SrsOnStatusCallPacket*>(msg->get_packet());  
1284 - if(pkt && (pkt->command_name == SRS_BW_CHECK_STARTING_PLAY))  
1285 - break;  
1286 - }  
1287 - srs_trace("BW check recv play begin response.");  
1288 -  
1289 - // send play data to client  
1290 - int64_t current_time = srs_get_system_time_ms();  
1291 - int size = 1024;  
1292 - char random_data[size];  
1293 - memset(random_data, 0x01, size);  
1294 -  
1295 - int interval = 0;  
1296 - while ( (srs_get_system_time_ms() - current_time) < duration_ms ) {  
1297 - st_usleep(interval);  
1298 - SrsCommonMessage* msg = new SrsCommonMessage;  
1299 - SrsOnStatusCallPacket* pkt = new SrsOnStatusCallPacket;  
1300 - pkt->command_name = SRS_BW_CHECK_PLAYING;  
1301 -  
1302 - int object_num = 1;  
1303 - for (int i = 0; i < object_num; ++i) {  
1304 - char buf[32];  
1305 - sprintf(buf, "%d", i);  
1306 - pkt->data->set(buf, new SrsAmf0String(random_data));  
1307 - }  
1308 - object_num += 1;  
1309 - msg->set_packet(pkt, 0);  
1310 -  
1311 - play_bytes += pkt->get_payload_length();  
1312 -  
1313 - if ((ret = protocol->send_message(msg)) != ERROR_SUCCESS) {  
1314 - srs_error("send bandwidth check play messages failed. ret=%d", ret);  
1315 - return ret;  
1316 - }  
1317 -  
1318 - // sleep while current kbps <= max_play_kbps  
1319 - int kbps = 0;  
1320 - while (true) {  
1321 - if(srs_get_system_time_ms() - current_time != 0)  
1322 - kbps = play_bytes * 8 / (srs_get_system_time_ms() - current_time);  
1323 -  
1324 - if (kbps > max_play_kbps) {  
1325 - st_usleep(500);  
1326 - } else {  
1327 - break;  
1328 - }  
1329 - }  
1330 - }  
1331 - actual_duration_ms = srs_get_system_time_ms() - current_time;  
1332 - srs_trace("BW check send play bytes over.");  
1333 -  
1334 - // notify client to stop play  
1335 - SrsCommonMessage* stop_play_msg = new SrsCommonMessage;  
1336 - SrsOnStatusCallPacket* stop_play_pkt = new SrsOnStatusCallPacket;  
1337 - stop_play_pkt->command_name = SRS_BW_CHECK_STOP_PLAY;  
1338 - stop_play_pkt->data->set("duration_ms", new SrsAmf0Number(duration_ms));  
1339 - stop_play_pkt->data->set("interval_ms", new SrsAmf0Number(interval_ms));  
1340 - stop_play_pkt->data->set("duration_delta", new SrsAmf0Number(actual_duration_ms));  
1341 - stop_play_pkt->data->set("bytes_delta", new SrsAmf0Number(play_bytes));  
1342 -  
1343 - stop_play_msg->set_packet(stop_play_pkt, 0);  
1344 -  
1345 - if ((ret = protocol->send_message(stop_play_msg)) != ERROR_SUCCESS) {  
1346 - srs_error("send bandwidth check stop play message failed. ret=%d", ret);  
1347 - return ret;  
1348 - }  
1349 - srs_trace("BW check stop play bytes.");  
1350 -  
1351 - // recv client's stop play response.  
1352 - while (true) {  
1353 - SrsCommonMessage* msg = 0;  
1354 - if ((ret = protocol->recv_message(&msg)) != ERROR_SUCCESS) {  
1355 - srs_error("recv client's stop play response failed. ret = %d", ret);  
1356 - return ret;  
1357 - }  
1358 -  
1359 - msg->decode_packet(protocol);  
1360 - SrsOnStatusCallPacket* pkt = dynamic_cast<SrsOnStatusCallPacket*>(msg->get_packet());  
1361 - if(pkt && (pkt->command_name == SRS_BW_CHECK_STOPPED_PLAY))  
1362 - break;  
1363 - }  
1364 - srs_trace("BW check recv stop play response.");  
1365 -  
1366 - return ret;  
1367 -}  
1368 -  
1369 -int SrsRtmp::bandwidth_check_publish(int duration_ms, int interval_ms, int &actual_duration_ms,  
1370 - int &publish_bytes, int max_pub_kbps)  
1371 -{  
1372 - int ret = ERROR_SUCCESS;  
1373 -  
1374 - // notify client to start publish  
1375 - SrsCommonMessage* start_publish_msg = new SrsCommonMessage;  
1376 - SrsOnStatusCallPacket* start_publish_pkt = new SrsOnStatusCallPacket;  
1377 - start_publish_pkt->command_name = SRS_BW_CHECK_START_PUBLISH;  
1378 - start_publish_pkt->data->set("duration_ms", new SrsAmf0Number(duration_ms));  
1379 - start_publish_pkt->data->set("interval_ms", new SrsAmf0Number(interval_ms));  
1380 -  
1381 - start_publish_msg->set_packet(start_publish_pkt, 0);  
1382 - if ((ret = protocol->send_message(start_publish_msg)) != ERROR_SUCCESS) {  
1383 - srs_error("send bandwidth check start publish message failed. ret=%d", ret);  
1384 - return ret;  
1385 - }  
1386 - srs_trace("BW check publish begin.");  
1387 -  
1388 - // read client's notification of starting publish  
1389 - while (true) {  
1390 - SrsCommonMessage* msg = 0;  
1391 - if ((ret = protocol->recv_message(&msg)) != ERROR_SUCCESS) {  
1392 - srs_error("recv client's notification of starting publish failed. ret = %d", ret);  
1393 - return ret;  
1394 - }  
1395 -  
1396 - msg->decode_packet(protocol);  
1397 - SrsOnStatusCallPacket* pkt = dynamic_cast<SrsOnStatusCallPacket*>(msg->get_packet());  
1398 - if(pkt && (pkt->command_name == SRS_BW_CHECK_STARTING_PUBLISH))  
1399 - break;  
1400 - }  
1401 - srs_trace("BW check recv publish begin response.");  
1402 -  
1403 - // recv publish msgs until @duration_ms ms  
1404 - int64_t current_time = srs_get_system_time_ms();  
1405 - while ( (srs_get_system_time_ms() - current_time) < duration_ms ) {  
1406 - st_usleep(0);  
1407 - SrsCommonMessage* msg = NULL;  
1408 - if ((ret = protocol->recv_message(&msg)) != ERROR_SUCCESS) {  
1409 - srs_error("recv message failed. ret=%d", ret);  
1410 - return ret;  
1411 - }  
1412 - SrsAutoFree(SrsCommonMessage, msg, false);  
1413 -  
1414 - publish_bytes += msg->header.payload_length;  
1415 -  
1416 - int kbps = 0;  
1417 - while (true) {  
1418 - if(srs_get_system_time_ms() - current_time != 0)  
1419 - kbps = publish_bytes * 8 / (srs_get_system_time_ms() - current_time);  
1420 -  
1421 - if (kbps > max_pub_kbps) {  
1422 - st_usleep(500);  
1423 - } else {  
1424 - break;  
1425 - }  
1426 - }  
1427 - }  
1428 - actual_duration_ms = srs_get_system_time_ms() - current_time;  
1429 - srs_trace("BW check recv publish data over.");  
1430 -  
1431 - // notify client to stop publish  
1432 - SrsCommonMessage* stop_publish_msg = new SrsCommonMessage;  
1433 - SrsOnStatusCallPacket* stop_publish_pkt = new SrsOnStatusCallPacket;  
1434 - stop_publish_pkt->command_name = SRS_BW_CHECK_STOP_PUBLISH;  
1435 - stop_publish_pkt->data->set("duration_ms", new SrsAmf0Number(duration_ms));  
1436 - stop_publish_pkt->data->set("interval_ms", new SrsAmf0Number(interval_ms));  
1437 - stop_publish_pkt->data->set("duration_delta", new SrsAmf0Number(actual_duration_ms));  
1438 - stop_publish_pkt->data->set("bytes_delta", new SrsAmf0Number(publish_bytes));  
1439 -  
1440 - stop_publish_msg->set_packet(stop_publish_pkt, 0);  
1441 - if ((ret = protocol->send_message(stop_publish_msg)) != ERROR_SUCCESS) {  
1442 - srs_error("send bandwidth check stop publish message failed. ret=%d", ret);  
1443 - return ret;  
1444 - }  
1445 - srs_trace("BW check stop pulish.");  
1446 -  
1447 - // recv left msg  
1448 - while (true) {  
1449 - if((ret = st_netfd_poll(stfd, POLLIN, 1000*500)) == ERROR_SUCCESS) {  
1450 - SrsCommonMessage* msg = 0;  
1451 -  
1452 - if ((ret = protocol->recv_message(&msg)) != ERROR_SUCCESS) {  
1453 - srs_error("recv client's left msg failed, ret = %d", ret);  
1454 - return ret;  
1455 - }  
1456 - } else {  
1457 - ret = ERROR_SUCCESS;  
1458 - break;  
1459 - }  
1460 - }  
1461 -  
1462 - return ret; 1185 + return ret;
1463 } 1186 }
1464 1187
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 The MIT License (MIT) 2 The MIT License (MIT)
3 3
4 Copyright (c) 2013 winlin 4 Copyright (c) 2013 winlin
5 -Copyright (c) 2013 wenjiegit  
6 5
7 Permission is hereby granted, free of charge, to any person obtaining a copy of 6 Permission is hereby granted, free of charge, to any person obtaining a copy of
8 this software and associated documentation files (the "Software"), to deal in 7 this software and associated documentation files (the "Software"), to deal in
@@ -63,7 +62,6 @@ struct SrsRequest @@ -63,7 +62,6 @@ struct SrsRequest
63 std::string port; 62 std::string port;
64 std::string app; 63 std::string app;
65 std::string stream; 64 std::string stream;
66 - std::string bw_key;  
67 65
68 SrsRequest(); 66 SrsRequest();
69 virtual ~SrsRequest(); 67 virtual ~SrsRequest();
@@ -104,7 +102,7 @@ enum SrsClientType @@ -104,7 +102,7 @@ enum SrsClientType
104 SrsClientUnknown, 102 SrsClientUnknown,
105 SrsClientPlay, 103 SrsClientPlay,
106 SrsClientFMLEPublish, 104 SrsClientFMLEPublish,
107 - SrsClientFlashPublish 105 + SrsClientFlashPublish,
108 }; 106 };
109 107
110 /** 108 /**
@@ -129,10 +127,10 @@ public: @@ -129,10 +127,10 @@ public:
129 virtual int send_message(ISrsMessage* msg); 127 virtual int send_message(ISrsMessage* msg);
130 public: 128 public:
131 virtual int handshake(); 129 virtual int handshake();
132 - virtual int connect_app(const std::string &app, const std::string &tc_url); 130 + virtual int connect_app(std::string app, std::string tc_url);
133 virtual int create_stream(int& stream_id); 131 virtual int create_stream(int& stream_id);
134 - virtual int play(const std::string &stream, int stream_id);  
135 - virtual int publish(const std::string &stream, int stream_id); 132 + virtual int play(std::string stream, int stream_id);
  133 + virtual int publish(std::string stream, int stream_id);
136 }; 134 };
137 135
138 /** 136 /**
@@ -169,16 +167,11 @@ public: @@ -169,16 +167,11 @@ public:
169 * using the Limit type field. 167 * using the Limit type field.
170 */ 168 */
171 virtual int set_peer_bandwidth(int bandwidth, int type); 169 virtual int set_peer_bandwidth(int bandwidth, int type);
172 -<<<<<<< HEAD  
173 - virtual int response_connect_app(SrsRequest* req, const char *ip = 0);  
174 - virtual int response_connect_reject(SrsRequest* req, const std::string& description);  
175 -=======  
176 /** 170 /**
177 * @param server_ip the ip of server. 171 * @param server_ip the ip of server.
178 */ 172 */
179 virtual int response_connect_app(SrsRequest* req, const char* server_ip = NULL); 173 virtual int response_connect_app(SrsRequest* req, const char* server_ip = NULL);
180 virtual void response_connect_reject(SrsRequest* req, const char* desc); 174 virtual void response_connect_reject(SrsRequest* req, const char* desc);
181 ->>>>>>> upstream/master  
182 virtual int on_bw_done(); 175 virtual int on_bw_done();
183 /** 176 /**
184 * recv some message to identify the client. 177 * recv some message to identify the client.
@@ -229,18 +222,10 @@ public: @@ -229,18 +222,10 @@ public:
229 * onStatus(NetStream.Publish.Start) 222 * onStatus(NetStream.Publish.Start)
230 */ 223 */
231 virtual int start_flash_publish(int stream_id); 224 virtual int start_flash_publish(int stream_id);
232 -  
233 - /**  
234 - * used to process band width check from client.  
235 - */  
236 - virtual int start_bandwidth_check(int limit_kbps);  
237 -  
238 private: 225 private:
239 virtual int identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsClientType& type, std::string& stream_name); 226 virtual int identify_create_stream_client(SrsCreateStreamPacket* req, int stream_id, SrsClientType& type, std::string& stream_name);
240 virtual int identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClientType& type, std::string& stream_name); 227 virtual int identify_fmle_publish_client(SrsFMLEStartPacket* req, SrsClientType& type, std::string& stream_name);
241 virtual int identify_flash_publish_client(SrsPublishPacket* req, SrsClientType& type, std::string& stream_name); 228 virtual int identify_flash_publish_client(SrsPublishPacket* req, SrsClientType& type, std::string& stream_name);
242 - virtual int bandwidth_check_play(int duration_ms, int interval_ms, int& actual_duration_ms, int& play_bytes, int max_play_kbps);  
243 - virtual int bandwidth_check_publish(int duration_ms, int interval_ms, int& actual_duration_ms, int& publish_bytes, int max_pub_kbps);  
244 }; 229 };
245 230
246 -#endif 231 +#endif
@@ -230,7 +230,7 @@ int SrsServer::cycle() @@ -230,7 +230,7 @@ int SrsServer::cycle()
230 // the deamon thread, update the time cache 230 // the deamon thread, update the time cache
231 while (true) { 231 while (true) {
232 st_usleep(SRS_TIME_RESOLUTION_MS * 1000); 232 st_usleep(SRS_TIME_RESOLUTION_MS * 1000);
233 - srs_update_system_time_ms(); 233 + srs_update_system_time_ms();
234 234
235 if (signal_reload) { 235 if (signal_reload) {
236 signal_reload = false; 236 signal_reload = false;
@@ -283,4 +283,4 @@ private: @@ -283,4 +283,4 @@ private:
283 virtual void destroy_forwarders(); 283 virtual void destroy_forwarders();
284 }; 284 };
285 285
286 -#endif 286 +#endif