winlin

support librtmp/ffmpeg without extended timestamp in 0xCX chunk packet. update signautre of server

@@ -46,6 +46,7 @@ url: rtmp://127.0.0.1:1935/live/livestream @@ -46,6 +46,7 @@ url: rtmp://127.0.0.1:1935/live/livestream
46 * nginx v1.5.0: 139524 lines <br/> 46 * nginx v1.5.0: 139524 lines <br/>
47 47
48 ### History 48 ### History
  49 +* v0.3, 2013-10-28, support librtmp without extended-timestamp in 0xCX chunk packet.
49 * v0.3, 2013-10-27, support cache last gop for client fast startup. 50 * v0.3, 2013-10-27, support cache last gop for client fast startup.
50 * v0.2, 2013-10-25, v0.2 released. 10125 lines. 51 * v0.2, 2013-10-25, v0.2 released. 10125 lines.
51 * v0.2, 2013-10-25, support flash publish. 52 * v0.2, 2013-10-25, support flash publish.
@@ -62,13 +62,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -62,13 +62,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62 } \ 62 } \
63 (void)0 63 (void)0
64 64
  65 +// current release version
  66 +#define RTMP_SIG_SRS_VERSION "0.2"
65 // server info. 67 // server info.
66 #define RTMP_SIG_SRS_KEY "srs" 68 #define RTMP_SIG_SRS_KEY "srs"
  69 +#define RTMP_SIG_SRS_ROLE "origin server"
67 #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(simple rtmp server)" 70 #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(simple rtmp server)"
68 -#define RTMP_SIG_SRS_URL "https://github.com/winlinvip/simple-rtmp-server" 71 +#define RTMP_SIG_SRS_URL "https://"RTMP_SIG_SRS_URL_SHORT
  72 +#define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server"
69 #define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin" 73 #define RTMP_SIG_SRS_WEB "http://blog.csdn.net/win_lin"
70 #define RTMP_SIG_SRS_EMAIL "winterserver@126.com" 74 #define RTMP_SIG_SRS_EMAIL "winterserver@126.com"
71 -#define RTMP_SIG_SRS_VERSION "0.1" 75 +#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
  76 +#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013 winlin"
72 77
73 // compare 78 // compare
74 #define srs_min(a, b) ((a < b)? a : b) 79 #define srs_min(a, b) ((a < b)? a : b)
@@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 25
26 #include <srs_core_error.hpp> 26 #include <srs_core_error.hpp>
27 #include <srs_core_socket.hpp> 27 #include <srs_core_socket.hpp>
  28 +#include <srs_core_log.hpp>
28 29
29 #define SOCKET_READ_SIZE 4096 30 #define SOCKET_READ_SIZE 4096
30 31
@@ -62,7 +63,11 @@ int SrsBuffer::ensure_buffer_bytes(SrsSocket* skt, int required_size) @@ -62,7 +63,11 @@ int SrsBuffer::ensure_buffer_bytes(SrsSocket* skt, int required_size)
62 { 63 {
63 int ret = ERROR_SUCCESS; 64 int ret = ERROR_SUCCESS;
64 65
65 - srs_assert(required_size >= 0); 66 + if (required_size < 0) {
  67 + ret = ERROR_SYSTEM_SIZE_NEGATIVE;
  68 + srs_error("size is negative. size=%d, ret=%d", required_size, ret);
  69 + return ret;
  70 + }
66 71
67 while (size() < required_size) { 72 while (size() < required_size) {
68 char buffer[SOCKET_READ_SIZE]; 73 char buffer[SOCKET_READ_SIZE];
@@ -63,8 +63,8 @@ int SrsClient::do_cycle() @@ -63,8 +63,8 @@ int SrsClient::do_cycle()
63 } 63 }
64 srs_verbose("get peer ip success. ip=%s", ip); 64 srs_verbose("get peer ip success. ip=%s", ip);
65 65
66 - rtmp->set_recv_timeout(SRS_SEND_TIMEOUT_MS);  
67 - rtmp->set_send_timeout(SRS_SEND_TIMEOUT_MS); 66 + rtmp->set_recv_timeout(SRS_SEND_TIMEOUT_MS * 1000);
  67 + rtmp->set_send_timeout(SRS_SEND_TIMEOUT_MS * 1000);
68 68
69 if ((ret = rtmp->handshake()) != ERROR_SUCCESS) { 69 if ((ret = rtmp->handshake()) != ERROR_SUCCESS) {
70 srs_error("rtmp handshake failed. ret=%d", ret); 70 srs_error("rtmp handshake failed. ret=%d", ret);
@@ -185,7 +185,7 @@ int SrsClient::streaming_play(SrsSource* source) @@ -185,7 +185,7 @@ int SrsClient::streaming_play(SrsSource* source)
185 SrsAutoFree(SrsConsumer, consumer, false); 185 SrsAutoFree(SrsConsumer, consumer, false);
186 srs_verbose("consumer created success."); 186 srs_verbose("consumer created success.");
187 187
188 - rtmp->set_recv_timeout(SRS_PULSE_TIMEOUT_MS); 188 + rtmp->set_recv_timeout(SRS_PULSE_TIMEOUT_MS * 1000);
189 189
190 int64_t report_time = 0; 190 int64_t report_time = 0;
191 int64_t reported_time = 0; 191 int64_t reported_time = 0;
@@ -64,11 +64,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -64,11 +64,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64 #define ERROR_RTMP_CHUNK_SIZE 310 64 #define ERROR_RTMP_CHUNK_SIZE 310
65 #define ERROR_RTMP_TRY_SIMPLE_HS 311 65 #define ERROR_RTMP_TRY_SIMPLE_HS 311
66 #define ERROR_RTMP_CH_SCHEMA 312 66 #define ERROR_RTMP_CH_SCHEMA 312
  67 +#define ERROR_RTMP_PACKET_SIZE 313
67 68
68 #define ERROR_SYSTEM_STREAM_INIT 400 69 #define ERROR_SYSTEM_STREAM_INIT 400
69 #define ERROR_SYSTEM_PACKET_INVALID 401 70 #define ERROR_SYSTEM_PACKET_INVALID 401
70 #define ERROR_SYSTEM_CLIENT_INVALID 402 71 #define ERROR_SYSTEM_CLIENT_INVALID 402
71 #define ERROR_SYSTEM_ASSERT_FAILED 403 72 #define ERROR_SYSTEM_ASSERT_FAILED 403
  73 +#define ERROR_SYSTEM_SIZE_NEGATIVE 404
72 74
73 // see librtmp. 75 // see librtmp.
74 // failed when open ssl create the dh 76 // failed when open ssl create the dh
@@ -249,6 +249,9 @@ messages. @@ -249,6 +249,9 @@ messages.
249 /**************************************************************************** 249 /****************************************************************************
250 ***************************************************************************** 250 *****************************************************************************
251 ****************************************************************************/ 251 ****************************************************************************/
  252 +// when got a messae header, increase recv timeout to got an entire message.
  253 +#define SRS_MIN_RECV_TIMEOUT_US 3000
  254 +
252 SrsProtocol::AckWindowSize::AckWindowSize() 255 SrsProtocol::AckWindowSize::AckWindowSize()
253 { 256 {
254 ack_window_size = acked_size = 0; 257 ack_window_size = acked_size = 0;
@@ -278,14 +281,19 @@ SrsProtocol::~SrsProtocol() @@ -278,14 +281,19 @@ SrsProtocol::~SrsProtocol()
278 srs_freep(skt); 281 srs_freep(skt);
279 } 282 }
280 283
281 -void SrsProtocol::set_recv_timeout(int timeout_ms) 284 +void SrsProtocol::set_recv_timeout(int64_t timeout_us)
  285 +{
  286 + return skt->set_recv_timeout(timeout_us);
  287 +}
  288 +
  289 +int64_t SrsProtocol::get_recv_timeout()
282 { 290 {
283 - return skt->set_recv_timeout(timeout_ms); 291 + return skt->get_recv_timeout();
284 } 292 }
285 293
286 -void SrsProtocol::set_send_timeout(int timeout_ms) 294 +void SrsProtocol::set_send_timeout(int64_t timeout_us)
287 { 295 {
288 - return skt->set_send_timeout(timeout_ms); 296 + return skt->set_send_timeout(timeout_us);
289 } 297 }
290 298
291 int SrsProtocol::recv_message(SrsCommonMessage** pmsg) 299 int SrsProtocol::recv_message(SrsCommonMessage** pmsg)
@@ -602,17 +610,31 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg) @@ -602,17 +610,31 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg)
602 } 610 }
603 return ret; 611 return ret;
604 } 612 }
605 - srs_info("read basic header success. fmt=%d, cid=%d, bh_size=%d", fmt, cid, bh_size); 613 + srs_verbose("read basic header success. fmt=%d, cid=%d, bh_size=%d", fmt, cid, bh_size);
  614 +
  615 + // once we got the chunk message header,
  616 + // that is there is a real message in cache,
  617 + // increase the timeout to got it.
  618 + // For example, in the play loop, we set timeout to 100ms,
  619 + // when we got a chunk header, we should increase the timeout,
  620 + // or we maybe timeout and disconnect the client.
  621 + int64_t timeout_us = skt->get_recv_timeout();
  622 + if (timeout_us != (int64_t)ST_UTIME_NO_TIMEOUT) {
  623 + int64_t pkt_timeout_us = srs_max(timeout_us, SRS_MIN_RECV_TIMEOUT_US);
  624 + skt->set_recv_timeout(pkt_timeout_us);
  625 + srs_verbose("change recv timeout_us "
  626 + "from %"PRId64" to %"PRId64"", timeout_us, pkt_timeout_us);
  627 + }
606 628
607 // get the cached chunk stream. 629 // get the cached chunk stream.
608 SrsChunkStream* chunk = NULL; 630 SrsChunkStream* chunk = NULL;
609 631
610 if (chunk_streams.find(cid) == chunk_streams.end()) { 632 if (chunk_streams.find(cid) == chunk_streams.end()) {
611 chunk = chunk_streams[cid] = new SrsChunkStream(cid); 633 chunk = chunk_streams[cid] = new SrsChunkStream(cid);
612 - srs_info("cache new chunk stream: fmt=%d, cid=%d", fmt, cid); 634 + srs_verbose("cache new chunk stream: fmt=%d, cid=%d", fmt, cid);
613 } else { 635 } else {
614 chunk = chunk_streams[cid]; 636 chunk = chunk_streams[cid];
615 - srs_info("cached chunk stream: fmt=%d, cid=%d, size=%d, message(type=%d, size=%d, time=%d, sid=%d)", 637 + srs_verbose("cached chunk stream: fmt=%d, cid=%d, size=%d, message(type=%d, size=%d, time=%d, sid=%d)",
616 chunk->fmt, chunk->cid, (chunk->msg? chunk->msg->size : 0), chunk->header.message_type, chunk->header.payload_length, 638 chunk->fmt, chunk->cid, (chunk->msg? chunk->msg->size : 0), chunk->header.message_type, chunk->header.payload_length,
617 chunk->header.timestamp, chunk->header.stream_id); 639 chunk->header.timestamp, chunk->header.stream_id);
618 } 640 }
@@ -625,7 +647,7 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg) @@ -625,7 +647,7 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg)
625 } 647 }
626 return ret; 648 return ret;
627 } 649 }
628 - srs_info("read message header success. " 650 + srs_verbose("read message header success. "
629 "fmt=%d, mh_size=%d, ext_time=%d, size=%d, message(type=%d, size=%d, time=%d, sid=%d)", 651 "fmt=%d, mh_size=%d, ext_time=%d, size=%d, message(type=%d, size=%d, time=%d, sid=%d)",
630 fmt, mh_size, chunk->extended_timestamp, (chunk->msg? chunk->msg->size : 0), chunk->header.message_type, 652 fmt, mh_size, chunk->extended_timestamp, (chunk->msg? chunk->msg->size : 0), chunk->header.message_type,
631 chunk->header.payload_length, chunk->header.timestamp, chunk->header.stream_id); 653 chunk->header.payload_length, chunk->header.timestamp, chunk->header.stream_id);
@@ -640,9 +662,15 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg) @@ -640,9 +662,15 @@ int SrsProtocol::recv_interlaced_message(SrsCommonMessage** pmsg)
640 return ret; 662 return ret;
641 } 663 }
642 664
  665 + // reset the recv timeout
  666 + if (timeout_us != (int64_t)ST_UTIME_NO_TIMEOUT) {
  667 + skt->set_recv_timeout(timeout_us);
  668 + srs_verbose("reset recv timeout_us to %"PRId64"", timeout_us);
  669 + }
  670 +
643 // not got an entire RTMP message, try next chunk. 671 // not got an entire RTMP message, try next chunk.
644 if (!msg) { 672 if (!msg) {
645 - srs_info("get partial message success. chunk_payload_size=%d, size=%d, message(type=%d, size=%d, time=%d, sid=%d)", 673 + srs_verbose("get partial message success. chunk_payload_size=%d, size=%d, message(type=%d, size=%d, time=%d, sid=%d)",
646 payload_size, (msg? msg->size : (chunk->msg? chunk->msg->size : 0)), chunk->header.message_type, chunk->header.payload_length, 674 payload_size, (msg? msg->size : (chunk->msg? chunk->msg->size : 0)), chunk->header.message_type, chunk->header.payload_length,
647 chunk->header.timestamp, chunk->header.stream_id); 675 chunk->header.timestamp, chunk->header.stream_id);
648 return ret; 676 return ret;
@@ -827,6 +855,15 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz @@ -827,6 +855,15 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
827 pp[0] = *p++; 855 pp[0] = *p++;
828 pp[3] = 0; 856 pp[3] = 0;
829 857
  858 + // if msg exists in cache, the size must not changed.
  859 + if (chunk->msg->size > 0 && chunk->msg->size != chunk->header.payload_length) {
  860 + ret = ERROR_RTMP_PACKET_SIZE;
  861 + srs_error("msg exists in chunk cache, "
  862 + "size=%d cannot change to %d, ret=%d",
  863 + chunk->msg->size, chunk->header.payload_length, ret);
  864 + return ret;
  865 + }
  866 +
830 chunk->header.message_type = *p++; 867 chunk->header.message_type = *p++;
831 868
832 if (fmt == 0) { 869 if (fmt == 0) {
@@ -867,11 +904,21 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz @@ -867,11 +904,21 @@ int SrsProtocol::read_message_header(SrsChunkStream* chunk, char fmt, int bh_siz
867 return ret; 904 return ret;
868 } 905 }
869 906
870 - char* pp = (char*)&chunk->header.timestamp; 907 + // ffmpeg/librtmp may donot send this filed, need to detect the value.
  908 + // @see also: http://blog.csdn.net/win_lin/article/details/13363699
  909 + int32_t timestamp = 0x00;
  910 + char* pp = (char*)&timestamp;
871 pp[3] = *p++; 911 pp[3] = *p++;
872 pp[2] = *p++; 912 pp[2] = *p++;
873 pp[1] = *p++; 913 pp[1] = *p++;
874 pp[0] = *p++; 914 pp[0] = *p++;
  915 +
  916 + if (chunk->header.timestamp > RTMP_EXTENDED_TIMESTAMP && chunk->header.timestamp != timestamp) {
  917 + mh_size -= 4;
  918 + srs_verbose("ignore the 4bytes extended timestamp. mh_size=%d", mh_size);
  919 + } else {
  920 + chunk->header.timestamp = timestamp;
  921 + }
875 srs_verbose("header read ext_time completed. time=%d", chunk->header.timestamp); 922 srs_verbose("header read ext_time completed. time=%d", chunk->header.timestamp);
876 } 923 }
877 924
@@ -897,7 +944,7 @@ int SrsProtocol::read_message_payload(SrsChunkStream* chunk, int bh_size, int mh @@ -897,7 +944,7 @@ int SrsProtocol::read_message_payload(SrsChunkStream* chunk, int bh_size, int mh
897 int ret = ERROR_SUCCESS; 944 int ret = ERROR_SUCCESS;
898 945
899 // empty message 946 // empty message
900 - if (chunk->header.payload_length == 0) { 947 + if (chunk->header.payload_length <= 0) {
901 // need erase the header in buffer. 948 // need erase the header in buffer.
902 buffer->erase(bh_size + mh_size); 949 buffer->erase(bh_size + mh_size);
903 950
@@ -104,11 +104,12 @@ public: @@ -104,11 +104,12 @@ public:
104 virtual ~SrsProtocol(); 104 virtual ~SrsProtocol();
105 public: 105 public:
106 /** 106 /**
107 - * set the timeout in ms. 107 + * set the timeout in us.
108 * if timeout, recv/send message return ERROR_SOCKET_TIMEOUT. 108 * if timeout, recv/send message return ERROR_SOCKET_TIMEOUT.
109 */ 109 */
110 - virtual void set_recv_timeout(int timeout_ms);  
111 - virtual void set_send_timeout(int timeout_ms); 110 + virtual void set_recv_timeout(int64_t timeout_us);
  111 + virtual int64_t get_recv_timeout();
  112 + virtual void set_send_timeout(int64_t timeout_us);
112 /** 113 /**
113 * recv a message with raw/undecoded payload from peer. 114 * recv a message with raw/undecoded payload from peer.
114 * the payload is not decoded, use srs_rtmp_expect_message<T> if requires 115 * the payload is not decoded, use srs_rtmp_expect_message<T> if requires
@@ -149,14 +149,19 @@ SrsRtmp::~SrsRtmp() @@ -149,14 +149,19 @@ SrsRtmp::~SrsRtmp()
149 srs_freep(complex_handshake); 149 srs_freep(complex_handshake);
150 } 150 }
151 151
152 -void SrsRtmp::set_recv_timeout(int timeout_ms) 152 +void SrsRtmp::set_recv_timeout(int64_t timeout_us)
153 { 153 {
154 - return protocol->set_recv_timeout(timeout_ms); 154 + return protocol->set_recv_timeout(timeout_us);
155 } 155 }
156 156
157 -void SrsRtmp::set_send_timeout(int timeout_ms) 157 +int64_t SrsRtmp::get_recv_timeout()
158 { 158 {
159 - return protocol->set_send_timeout(timeout_ms); 159 + return protocol->get_recv_timeout();
  160 +}
  161 +
  162 +void SrsRtmp::set_send_timeout(int64_t timeout_us)
  163 +{
  164 + return protocol->set_send_timeout(timeout_us);
160 } 165 }
161 166
162 int SrsRtmp::recv_message(SrsCommonMessage** pmsg) 167 int SrsRtmp::recv_message(SrsCommonMessage** pmsg)
@@ -176,7 +181,6 @@ int SrsRtmp::handshake() @@ -176,7 +181,6 @@ int SrsRtmp::handshake()
176 ssize_t nsize; 181 ssize_t nsize;
177 SrsSocket skt(stfd); 182 SrsSocket skt(stfd);
178 183
179 - // TODO: complex handshake for h264/aac codec.  
180 char* c0c1 = new char[1537]; 184 char* c0c1 = new char[1537];
181 SrsAutoFree(char, c0c1, true); 185 SrsAutoFree(char, c0c1, true);
182 if ((ret = skt.read_fully(c0c1, 1537, &nsize)) != ERROR_SUCCESS) { 186 if ((ret = skt.read_fully(c0c1, 1537, &nsize)) != ERROR_SUCCESS) {
@@ -325,10 +329,15 @@ int SrsRtmp::response_connect_app(SrsRequest* req) @@ -325,10 +329,15 @@ int SrsRtmp::response_connect_app(SrsRequest* req)
325 SrsASrsAmf0EcmaArray* data = new SrsASrsAmf0EcmaArray(); 329 SrsASrsAmf0EcmaArray* data = new SrsASrsAmf0EcmaArray();
326 pkt->info->set("data", data); 330 pkt->info->set("data", data);
327 331
328 - data->set("version", new SrsAmf0String(RTMP_SIG_FMS_VER));  
329 - data->set("server", new SrsAmf0String(RTMP_SIG_SRS_NAME)); 332 + data->set("srs_version", new SrsAmf0String(RTMP_SIG_FMS_VER));
  333 + data->set("srs_server", new SrsAmf0String(RTMP_SIG_SRS_NAME));
  334 + data->set("srs_license", new SrsAmf0String(RTMP_SIG_SRS_LICENSE));
  335 + data->set("srs_role", new SrsAmf0String(RTMP_SIG_SRS_ROLE));
330 data->set("srs_url", new SrsAmf0String(RTMP_SIG_SRS_URL)); 336 data->set("srs_url", new SrsAmf0String(RTMP_SIG_SRS_URL));
331 data->set("srs_version", new SrsAmf0String(RTMP_SIG_SRS_VERSION)); 337 data->set("srs_version", new SrsAmf0String(RTMP_SIG_SRS_VERSION));
  338 + data->set("srs_site", new SrsAmf0String(RTMP_SIG_SRS_WEB));
  339 + data->set("srs_email", new SrsAmf0String(RTMP_SIG_SRS_EMAIL));
  340 + data->set("srs_copyright", new SrsAmf0String(RTMP_SIG_SRS_COPYRIGHT));
332 341
333 msg->set_packet(pkt, 0); 342 msg->set_packet(pkt, 0);
334 343
@@ -105,8 +105,9 @@ public: @@ -105,8 +105,9 @@ public:
105 SrsRtmp(st_netfd_t client_stfd); 105 SrsRtmp(st_netfd_t client_stfd);
106 virtual ~SrsRtmp(); 106 virtual ~SrsRtmp();
107 public: 107 public:
108 - virtual void set_recv_timeout(int timeout_ms);  
109 - virtual void set_send_timeout(int timeout_ms); 108 + virtual void set_recv_timeout(int64_t timeout_us);
  109 + virtual int64_t get_recv_timeout();
  110 + virtual void set_send_timeout(int64_t timeout_us);
110 virtual int recv_message(SrsCommonMessage** pmsg); 111 virtual int recv_message(SrsCommonMessage** pmsg);
111 virtual int send_message(ISrsMessage* msg); 112 virtual int send_message(ISrsMessage* msg);
112 public: 113 public:
@@ -36,14 +36,19 @@ SrsSocket::~SrsSocket() @@ -36,14 +36,19 @@ SrsSocket::~SrsSocket()
36 { 36 {
37 } 37 }
38 38
39 -void SrsSocket::set_recv_timeout(int timeout_ms) 39 +void SrsSocket::set_recv_timeout(int64_t timeout_us)
40 { 40 {
41 - recv_timeout = timeout_ms * 1000; 41 + recv_timeout = timeout_us;
42 } 42 }
43 43
44 -void SrsSocket::set_send_timeout(int timeout_ms) 44 +int64_t SrsSocket::get_recv_timeout()
45 { 45 {
46 - send_timeout = timeout_ms * 1000; 46 + return recv_timeout;
  47 +}
  48 +
  49 +void SrsSocket::set_send_timeout(int64_t timeout_us)
  50 +{
  51 + send_timeout = timeout_us;
47 } 52 }
48 53
49 int64_t SrsSocket::get_recv_bytes() 54 int64_t SrsSocket::get_recv_bytes()
@@ -48,8 +48,9 @@ public: @@ -48,8 +48,9 @@ public:
48 SrsSocket(st_netfd_t client_stfd); 48 SrsSocket(st_netfd_t client_stfd);
49 virtual ~SrsSocket(); 49 virtual ~SrsSocket();
50 public: 50 public:
51 - virtual void set_recv_timeout(int timeout_ms);  
52 - virtual void set_send_timeout(int timeout_ms); 51 + virtual void set_recv_timeout(int64_t timeout_us);
  52 + virtual int64_t get_recv_timeout();
  53 + virtual void set_send_timeout(int64_t timeout_us);
53 virtual int64_t get_recv_bytes(); 54 virtual int64_t get_recv_bytes();
54 virtual int64_t get_send_bytes(); 55 virtual int64_t get_send_bytes();
55 public: 56 public:
@@ -179,8 +179,8 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata @@ -179,8 +179,8 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata
179 { 179 {
180 int ret = ERROR_SUCCESS; 180 int ret = ERROR_SUCCESS;
181 181
182 - metadata->metadata->set("server",  
183 - new SrsAmf0String(RTMP_SIG_SRS_NAME""RTMP_SIG_SRS_VERSION)); 182 + metadata->metadata->set("server", new SrsAmf0String(
  183 + RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));
184 184
185 // encode the metadata to payload 185 // encode the metadata to payload
186 int size = metadata->get_payload_length(); 186 int size = metadata->get_payload_length();