正在显示
9 个修改的文件
包含
88 行增加
和
61 行删除
| @@ -181,7 +181,7 @@ int SrsEdgeIngester::ingest() | @@ -181,7 +181,7 @@ int SrsEdgeIngester::ingest() | ||
| 181 | // pithy print | 181 | // pithy print |
| 182 | if (pithy_print.can_print()) { | 182 | if (pithy_print.can_print()) { |
| 183 | kbps->sample(); | 183 | kbps->sample(); |
| 184 | - srs_trace("<- "SRS_LOG_ID_EDGE_PLAY | 184 | + srs_trace("<- "SRS_CONSTS_LOG_EDGE_PLAY |
| 185 | " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d", | 185 | " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d", |
| 186 | pithy_print.age(), | 186 | pithy_print.age(), |
| 187 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), | 187 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), |
| @@ -453,7 +453,7 @@ int SrsEdgeForwarder::cycle() | @@ -453,7 +453,7 @@ int SrsEdgeForwarder::cycle() | ||
| 453 | // pithy print | 453 | // pithy print |
| 454 | if (pithy_print.can_print()) { | 454 | if (pithy_print.can_print()) { |
| 455 | kbps->sample(); | 455 | kbps->sample(); |
| 456 | - srs_trace("-> "SRS_LOG_ID_EDGE_PUBLISH | 456 | + srs_trace("-> "SRS_CONSTS_LOG_EDGE_PUBLISH |
| 457 | " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d", | 457 | " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d", |
| 458 | pithy_print.age(), count, | 458 | pithy_print.age(), count, |
| 459 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), | 459 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), |
| @@ -331,7 +331,7 @@ void SrsEncoder::encoder() | @@ -331,7 +331,7 @@ void SrsEncoder::encoder() | ||
| 331 | // reportable | 331 | // reportable |
| 332 | if (pithy_print->can_print()) { | 332 | if (pithy_print->can_print()) { |
| 333 | // TODO: FIXME: show more info. | 333 | // TODO: FIXME: show more info. |
| 334 | - srs_trace("-> "SRS_LOG_ID_ENCODER" time=%"PRId64", encoders=%d, input=%s", | 334 | + srs_trace("-> "SRS_CONSTS_LOG_ENCODER" time=%"PRId64", encoders=%d, input=%s", |
| 335 | pithy_print->age(), (int)ffmpegs.size(), input_stream_name.c_str()); | 335 | pithy_print->age(), (int)ffmpegs.size(), input_stream_name.c_str()); |
| 336 | } | 336 | } |
| 337 | } | 337 | } |
| @@ -318,7 +318,7 @@ int SrsForwarder::forward() | @@ -318,7 +318,7 @@ int SrsForwarder::forward() | ||
| 318 | // pithy print | 318 | // pithy print |
| 319 | if (pithy_print.can_print()) { | 319 | if (pithy_print.can_print()) { |
| 320 | kbps->sample(); | 320 | kbps->sample(); |
| 321 | - srs_trace("-> "SRS_LOG_ID_FOWARDER | 321 | + srs_trace("-> "SRS_CONSTS_LOG_FOWARDER |
| 322 | " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d", | 322 | " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d", |
| 323 | pithy_print.age(), count, | 323 | pithy_print.age(), count, |
| 324 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), | 324 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), |
| @@ -1521,7 +1521,7 @@ void SrsHls::hls_mux() | @@ -1521,7 +1521,7 @@ void SrsHls::hls_mux() | ||
| 1521 | // the run time is not equals to stream time, | 1521 | // the run time is not equals to stream time, |
| 1522 | // @see: https://github.com/winlinvip/simple-rtmp-server/issues/81#issuecomment-48100994 | 1522 | // @see: https://github.com/winlinvip/simple-rtmp-server/issues/81#issuecomment-48100994 |
| 1523 | // it's ok. | 1523 | // it's ok. |
| 1524 | - srs_trace("-> "SRS_LOG_ID_HLS | 1524 | + srs_trace("-> "SRS_CONSTS_LOG_HLS |
| 1525 | " time=%"PRId64", stream dts=%"PRId64"(%"PRId64"ms), sequence_no=%d", | 1525 | " time=%"PRId64", stream dts=%"PRId64"(%"PRId64"ms), sequence_no=%d", |
| 1526 | pithy_print->age(), stream_dts, stream_dts / 90, muxer->sequence_no()); | 1526 | pithy_print->age(), stream_dts, stream_dts / 90, muxer->sequence_no()); |
| 1527 | } | 1527 | } |
| @@ -350,7 +350,7 @@ void SrsIngester::ingester() | @@ -350,7 +350,7 @@ void SrsIngester::ingester() | ||
| 350 | // reportable | 350 | // reportable |
| 351 | if (pithy_print->can_print()) { | 351 | if (pithy_print->can_print()) { |
| 352 | // TODO: FIXME: show more info. | 352 | // TODO: FIXME: show more info. |
| 353 | - srs_trace("-> "SRS_LOG_ID_INGESTER | 353 | + srs_trace("-> "SRS_CONSTS_LOG_INGESTER |
| 354 | " time=%"PRId64", ingesters=%d", pithy_print->age(), (int)ingesters.size()); | 354 | " time=%"PRId64", ingesters=%d", pithy_print->age(), (int)ingesters.size()); |
| 355 | } | 355 | } |
| 356 | } | 356 | } |
| @@ -548,7 +548,7 @@ int SrsRtmpConn::playing(SrsSource* source) | @@ -548,7 +548,7 @@ int SrsRtmpConn::playing(SrsSource* source) | ||
| 548 | // reportable | 548 | // reportable |
| 549 | if (pithy_print.can_print()) { | 549 | if (pithy_print.can_print()) { |
| 550 | kbps->sample(); | 550 | kbps->sample(); |
| 551 | - srs_trace("-> "SRS_LOG_ID_PLAY | 551 | + srs_trace("-> "SRS_CONSTS_LOG_PLAY |
| 552 | " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d", | 552 | " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d", |
| 553 | pithy_print.age(), count, | 553 | pithy_print.age(), count, |
| 554 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), | 554 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), |
| @@ -642,7 +642,7 @@ int SrsRtmpConn::fmle_publishing(SrsSource* source) | @@ -642,7 +642,7 @@ int SrsRtmpConn::fmle_publishing(SrsSource* source) | ||
| 642 | // reportable | 642 | // reportable |
| 643 | if (pithy_print.can_print()) { | 643 | if (pithy_print.can_print()) { |
| 644 | kbps->sample(); | 644 | kbps->sample(); |
| 645 | - srs_trace("<- "SRS_LOG_ID_CLIENT_PUBLISH | 645 | + srs_trace("<- "SRS_CONSTS_LOG_CLIENT_PUBLISH |
| 646 | " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d", pithy_print.age(), | 646 | " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d", pithy_print.age(), |
| 647 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), | 647 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), |
| 648 | kbps->get_recv_kbps(), kbps->get_recv_kbps_30s(), kbps->get_recv_kbps_5m()); | 648 | kbps->get_recv_kbps(), kbps->get_recv_kbps_30s(), kbps->get_recv_kbps_5m()); |
| @@ -723,7 +723,7 @@ int SrsRtmpConn::flash_publishing(SrsSource* source) | @@ -723,7 +723,7 @@ int SrsRtmpConn::flash_publishing(SrsSource* source) | ||
| 723 | // reportable | 723 | // reportable |
| 724 | if (pithy_print.can_print()) { | 724 | if (pithy_print.can_print()) { |
| 725 | kbps->sample(); | 725 | kbps->sample(); |
| 726 | - srs_trace("<- "SRS_LOG_ID_WEB_PUBLISH | 726 | + srs_trace("<- "SRS_CONSTS_LOG_WEB_PUBLISH |
| 727 | " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d", | 727 | " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d", |
| 728 | pithy_print.age(), | 728 | pithy_print.age(), |
| 729 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), | 729 | kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(), |
| @@ -31,6 +31,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,6 +31,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | /////////////////////////////////////////////////////////// | 33 | /////////////////////////////////////////////////////////// |
| 34 | +/////////////////////////////////////////////////////////// | ||
| 35 | +/////////////////////////////////////////////////////////// | ||
| 36 | +/////////////////////////////////////////////////////////// | ||
| 37 | +/////////////////////////////////////////////////////////// | ||
| 38 | +/////////////////////////////////////////////////////////// | ||
| 39 | + | ||
| 40 | +/////////////////////////////////////////////////////////// | ||
| 34 | // RTMP consts values | 41 | // RTMP consts values |
| 35 | /////////////////////////////////////////////////////////// | 42 | /////////////////////////////////////////////////////////// |
| 36 | // default vhost of rtmp | 43 | // default vhost of rtmp |
| @@ -43,11 +50,80 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -43,11 +50,80 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 43 | // 6. Chunking, RTMP protocol default chunk size. | 50 | // 6. Chunking, RTMP protocol default chunk size. |
| 44 | #define SRS_CONSTS_RTMP_PROTOCOL_CHUNK_SIZE 128 | 51 | #define SRS_CONSTS_RTMP_PROTOCOL_CHUNK_SIZE 128 |
| 45 | 52 | ||
| 53 | +// the following is the timeout for rtmp protocol, | ||
| 54 | +// to avoid death connection. | ||
| 55 | + | ||
| 56 | +// the timeout to wait client data, | ||
| 57 | +// if timeout, close the connection. | ||
| 58 | +#define SRS_SEND_TIMEOUT_US (int64_t)(30*1000*1000LL) | ||
| 59 | + | ||
| 60 | +// the timeout to send data to client, | ||
| 61 | +// if timeout, close the connection. | ||
| 62 | +#define SRS_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL) | ||
| 63 | + | ||
| 64 | +// the timeout to wait for client control message, | ||
| 65 | +// if timeout, we generally ignore and send the data to client, | ||
| 66 | +// generally, it's the pulse time for data seding. | ||
| 67 | +#define SRS_PULSE_TIMEOUT_US (int64_t)(200*1000LL) | ||
| 68 | + | ||
| 69 | +/** | ||
| 70 | +* max rtmp header size: | ||
| 71 | +* 1bytes basic header, | ||
| 72 | +* 11bytes message header, | ||
| 73 | +* 4bytes timestamp header, | ||
| 74 | +* that is, 1+11+4=16bytes. | ||
| 75 | +*/ | ||
| 76 | +#define RTMP_MAX_FMT0_HEADER_SIZE 16 | ||
| 77 | +/** | ||
| 78 | +* max rtmp header size: | ||
| 79 | +* 1bytes basic header, | ||
| 80 | +* 4bytes timestamp header, | ||
| 81 | +* that is, 1+4=5bytes. | ||
| 82 | +*/ | ||
| 83 | +// always use fmt0 as cache. | ||
| 84 | +//#define RTMP_MAX_FMT3_HEADER_SIZE 5 | ||
| 85 | + | ||
| 86 | +/////////////////////////////////////////////////////////// | ||
| 87 | +/////////////////////////////////////////////////////////// | ||
| 88 | +/////////////////////////////////////////////////////////// | ||
| 89 | +/////////////////////////////////////////////////////////// | ||
| 90 | +/////////////////////////////////////////////////////////// | ||
| 91 | +/////////////////////////////////////////////////////////// | ||
| 92 | + | ||
| 46 | /////////////////////////////////////////////////////////// | 93 | /////////////////////////////////////////////////////////// |
| 47 | // SRS consts values | 94 | // SRS consts values |
| 48 | /////////////////////////////////////////////////////////// | 95 | /////////////////////////////////////////////////////////// |
| 49 | #define SRS_CONSTS_NULL_FILE "/dev/null" | 96 | #define SRS_CONSTS_NULL_FILE "/dev/null" |
| 50 | #define SRS_CONSTS_LOCALHOST "127.0.0.1" | 97 | #define SRS_CONSTS_LOCALHOST "127.0.0.1" |
| 51 | 98 | ||
| 99 | +/////////////////////////////////////////////////////////// | ||
| 100 | +/////////////////////////////////////////////////////////// | ||
| 101 | +/////////////////////////////////////////////////////////// | ||
| 102 | +/////////////////////////////////////////////////////////// | ||
| 103 | +/////////////////////////////////////////////////////////// | ||
| 104 | +/////////////////////////////////////////////////////////// | ||
| 105 | + | ||
| 106 | +/////////////////////////////////////////////////////////// | ||
| 107 | +// log consts values | ||
| 108 | +/////////////////////////////////////////////////////////// | ||
| 109 | +// downloading speed-up, play to edge, ingest from origin | ||
| 110 | +#define SRS_CONSTS_LOG_EDGE_PLAY "EIG" | ||
| 111 | +// uploading speed-up, publish to edge, foward to origin | ||
| 112 | +#define SRS_CONSTS_LOG_EDGE_PUBLISH "EFW" | ||
| 113 | +// edge/origin forwarder. | ||
| 114 | +#define SRS_CONSTS_LOG_FOWARDER "FWR" | ||
| 115 | +// play stream on edge/origin. | ||
| 116 | +#define SRS_CONSTS_LOG_PLAY "PLA" | ||
| 117 | +// client publish to edge/origin | ||
| 118 | +#define SRS_CONSTS_LOG_CLIENT_PUBLISH "CPB" | ||
| 119 | +// web/flash publish to edge/origin | ||
| 120 | +#define SRS_CONSTS_LOG_WEB_PUBLISH "WPB" | ||
| 121 | +// ingester for edge(play)/origin | ||
| 122 | +#define SRS_CONSTS_LOG_INGESTER "IGS" | ||
| 123 | +// hls log id. | ||
| 124 | +#define SRS_CONSTS_LOG_HLS "HLS" | ||
| 125 | +// encoder log id. | ||
| 126 | +#define SRS_CONSTS_LOG_ENCODER "ENC" | ||
| 127 | + | ||
| 52 | 128 | ||
| 53 | #endif | 129 | #endif |
| @@ -35,6 +35,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -35,6 +35,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 35 | #include <errno.h> | 35 | #include <errno.h> |
| 36 | #include <string.h> | 36 | #include <string.h> |
| 37 | 37 | ||
| 38 | +#include <srs_kernel_consts.hpp> | ||
| 39 | + | ||
| 38 | /** | 40 | /** |
| 39 | * the log level, for example: | 41 | * the log level, for example: |
| 40 | * if specified Debug level, all level messages will be logged. | 42 | * if specified Debug level, all level messages will be logged. |
| @@ -144,23 +146,4 @@ extern ISrsThreadContext* _srs_context; | @@ -144,23 +146,4 @@ extern ISrsThreadContext* _srs_context; | ||
| 144 | #define srs_trace(msg, ...) (void)0 | 146 | #define srs_trace(msg, ...) (void)0 |
| 145 | #endif | 147 | #endif |
| 146 | 148 | ||
| 147 | -// downloading speed-up, play to edge, ingest from origin | ||
| 148 | -#define SRS_LOG_ID_EDGE_PLAY "EIG" | ||
| 149 | -// uploading speed-up, publish to edge, foward to origin | ||
| 150 | -#define SRS_LOG_ID_EDGE_PUBLISH "EFW" | ||
| 151 | -// edge/origin forwarder. | ||
| 152 | -#define SRS_LOG_ID_FOWARDER "FWR" | ||
| 153 | -// play stream on edge/origin. | ||
| 154 | -#define SRS_LOG_ID_PLAY "PLA" | ||
| 155 | -// client publish to edge/origin | ||
| 156 | -#define SRS_LOG_ID_CLIENT_PUBLISH "CPB" | ||
| 157 | -// web/flash publish to edge/origin | ||
| 158 | -#define SRS_LOG_ID_WEB_PUBLISH "WPB" | ||
| 159 | -// ingester for edge(play)/origin | ||
| 160 | -#define SRS_LOG_ID_INGESTER "IGS" | ||
| 161 | -// hls log id. | ||
| 162 | -#define SRS_LOG_ID_HLS "HLS" | ||
| 163 | -// encoder log id. | ||
| 164 | -#define SRS_LOG_ID_ENCODER "ENC" | ||
| 165 | - | ||
| 166 | #endif | 149 | #endif |
| @@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 35 | 35 | ||
| 36 | #include <srs_kernel_log.hpp> | 36 | #include <srs_kernel_log.hpp> |
| 37 | #include <srs_kernel_error.hpp> | 37 | #include <srs_kernel_error.hpp> |
| 38 | +#include <srs_kernel_consts.hpp> | ||
| 38 | 39 | ||
| 39 | class ISrsProtocolReaderWriter; | 40 | class ISrsProtocolReaderWriter; |
| 40 | class SrsBuffer; | 41 | class SrsBuffer; |
| @@ -46,39 +47,6 @@ class SrsMessageHeader; | @@ -46,39 +47,6 @@ class SrsMessageHeader; | ||
| 46 | class SrsMessage; | 47 | class SrsMessage; |
| 47 | class SrsChunkStream; | 48 | class SrsChunkStream; |
| 48 | 49 | ||
| 49 | -// the following is the timeout for rtmp protocol, | ||
| 50 | -// to avoid death connection. | ||
| 51 | - | ||
| 52 | -// the timeout to wait client data, | ||
| 53 | -// if timeout, close the connection. | ||
| 54 | -#define SRS_SEND_TIMEOUT_US (int64_t)(30*1000*1000LL) | ||
| 55 | - | ||
| 56 | -// the timeout to send data to client, | ||
| 57 | -// if timeout, close the connection. | ||
| 58 | -#define SRS_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL) | ||
| 59 | - | ||
| 60 | -// the timeout to wait for client control message, | ||
| 61 | -// if timeout, we generally ignore and send the data to client, | ||
| 62 | -// generally, it's the pulse time for data seding. | ||
| 63 | -#define SRS_PULSE_TIMEOUT_US (int64_t)(200*1000LL) | ||
| 64 | - | ||
| 65 | -/** | ||
| 66 | -* max rtmp header size: | ||
| 67 | -* 1bytes basic header, | ||
| 68 | -* 11bytes message header, | ||
| 69 | -* 4bytes timestamp header, | ||
| 70 | -* that is, 1+11+4=16bytes. | ||
| 71 | -*/ | ||
| 72 | -#define RTMP_MAX_FMT0_HEADER_SIZE 16 | ||
| 73 | -/** | ||
| 74 | -* max rtmp header size: | ||
| 75 | -* 1bytes basic header, | ||
| 76 | -* 4bytes timestamp header, | ||
| 77 | -* that is, 1+4=5bytes. | ||
| 78 | -*/ | ||
| 79 | -// always use fmt0 as cache. | ||
| 80 | -//#define RTMP_MAX_FMT3_HEADER_SIZE 5 | ||
| 81 | - | ||
| 82 | /** | 50 | /** |
| 83 | * the protocol provides the rtmp-message-protocol services, | 51 | * the protocol provides the rtmp-message-protocol services, |
| 84 | * to recv RTMP message from RTMP chunk stream, | 52 | * to recv RTMP message from RTMP chunk stream, |
-
请 注册 或 登录 后发表评论