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

STAT: Add hls-play, flv-play, srt-play and srt-publish.

This commit is contained in:
winlin 2022-08-27 18:47:49 +08:00
parent 2944fe430f
commit 101e4fa3b9
4 changed files with 20 additions and 10 deletions

View file

@ -127,7 +127,7 @@ srs_error_t SrsHlsStream::serve_m3u8_ctx(ISrsHttpResponseWriter* w, ISrsHttpMess
// update the statistic when source disconveried. // update the statistic when source disconveried.
SrsStatistic* stat = SrsStatistic::instance(); SrsStatistic* stat = SrsStatistic::instance();
if ((err = stat->on_client(ctx, req, NULL, SrsRtmpConnPlay)) != srs_success) { if ((err = stat->on_client(ctx, req, NULL, SrsHlsPlay)) != srs_success) {
return srs_error_wrap(err, "stat on client"); return srs_error_wrap(err, "stat on client");
} }

View file

@ -592,7 +592,7 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
// update the statistic when source disconveried. // update the statistic when source disconveried.
SrsStatistic* stat = SrsStatistic::instance(); SrsStatistic* stat = SrsStatistic::instance();
if ((err = stat->on_client(_srs_context->get_id().c_str(), req, hc, SrsRtmpConnPlay)) != srs_success) { if ((err = stat->on_client(_srs_context->get_id().c_str(), req, hc, SrsFlvPlay)) != srs_success) {
return srs_error_wrap(err, "stat on client"); return srs_error_wrap(err, "stat on client");
} }

View file

@ -1627,18 +1627,22 @@ string srs_client_type_string(SrsRtmpConnType type)
{ {
switch (type) { switch (type) {
case SrsRtmpConnPlay: return "rtmp-play"; case SrsRtmpConnPlay: return "rtmp-play";
case SrsHlsPlay: return "hls-play";
case SrsFlvPlay: return "flv-play";
case SrsRtcConnPlay: return "rtc-play"; case SrsRtcConnPlay: return "rtc-play";
case SrsRtmpConnFlashPublish: return "flash-publish"; case SrsRtmpConnFlashPublish: return "flash-publish";
case SrsRtmpConnFMLEPublish: return "fmle-publish"; case SrsRtmpConnFMLEPublish: return "fmle-publish";
case SrsRtmpConnHaivisionPublish: return "haivision-publish"; case SrsRtmpConnHaivisionPublish: return "haivision-publish";
case SrsRtcConnPublish: return "rtc-publish"; case SrsRtcConnPublish: return "rtc-publish";
case SrsSrtConnPlay: return "srt-play";
case SrsSrtConnPublish: return "srt-publish";
default: return "Unknown"; default: return "Unknown";
} }
} }
bool srs_client_type_is_publish(SrsRtmpConnType type) bool srs_client_type_is_publish(SrsRtmpConnType type)
{ {
return ((type != SrsRtmpConnPlay) && (type != SrsRtcConnPlay)); return (type & 0xff00) == 0x0200;
} }
SrsHandshakeBytes::SrsHandshakeBytes() SrsHandshakeBytes::SrsHandshakeBytes()

View file

@ -470,13 +470,19 @@ public:
// The rtmp client type. // The rtmp client type.
enum SrsRtmpConnType enum SrsRtmpConnType
{ {
SrsRtmpConnUnknown, SrsRtmpConnUnknown = 0x0000,
SrsRtmpConnPlay, // All players.
SrsRtmpConnFMLEPublish, SrsRtmpConnPlay = 0x0100,
SrsRtmpConnFlashPublish, SrsHlsPlay = 0x0101,
SrsRtmpConnHaivisionPublish, SrsFlvPlay = 0x0102,
SrsRtcConnPlay, SrsRtcConnPlay = 0x0110,
SrsRtcConnPublish, SrsSrtConnPlay = 0x0120,
// All publishers.
SrsRtmpConnFMLEPublish = 0x0200,
SrsRtmpConnFlashPublish = 0x0201,
SrsRtmpConnHaivisionPublish = 0x0202,
SrsRtcConnPublish = 0x0210,
SrsSrtConnPublish = 0x0220,
}; };
std::string srs_client_type_string(SrsRtmpConnType type); std::string srs_client_type_string(SrsRtmpConnType type);
bool srs_client_type_is_publish(SrsRtmpConnType type); bool srs_client_type_is_publish(SrsRtmpConnType type);