From 14b318525e7d113d09a4e1a85de0ee6d5deecca1 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Fri, 5 Feb 2021 16:49:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0rtp=20rtmp=E4=B8=AA=E6=95=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 3 +++ src/Extension/Frame.h | 2 ++ src/Rtmp/Rtmp.cpp | 6 +++++- src/Rtmp/Rtmp.h | 4 ++++ src/Rtsp/Rtsp.cpp | 6 +++++- src/Rtsp/Rtsp.h | 4 ++++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 10e444cf..7d791214 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1043,6 +1043,9 @@ void installWebApi() { val["data"]["BufferRaw"] = (Json::UInt64)(ObjectStatistic::count()); val["data"]["BufferLikeString"] = (Json::UInt64)(ObjectStatistic::count()); val["data"]["BufferList"] = (Json::UInt64)(ObjectStatistic::count()); + + val["data"]["RtpPacket"] = (Json::UInt64)(ObjectStatistic::count()); + val["data"]["RtmpPacket"] = (Json::UInt64)(ObjectStatistic::count()); }); ////////////以下是注册的Hook API//////////// diff --git a/src/Extension/Frame.h b/src/Extension/Frame.h index 4da57732..4988ac06 100644 --- a/src/Extension/Frame.h +++ b/src/Extension/Frame.h @@ -173,6 +173,8 @@ public: uint32_t _pts = 0; size_t _prefix_size = 0; BufferLikeString _buffer; + +private: //对象个数统计 ObjectStatistic _statistic; diff --git a/src/Rtmp/Rtmp.cpp b/src/Rtmp/Rtmp.cpp index 272e1c91..451f54e9 100644 --- a/src/Rtmp/Rtmp.cpp +++ b/src/Rtmp/Rtmp.cpp @@ -146,4 +146,8 @@ RtmpPacket::Ptr RtmpPacket::create(){ #endif } -}//namespace mediakit \ No newline at end of file +}//namespace mediakit + +namespace toolkit { + StatisticImp(mediakit::RtmpPacket); +} \ No newline at end of file diff --git a/src/Rtmp/Rtmp.h b/src/Rtmp/Rtmp.h index 15eec7f1..0e0a6cf4 100644 --- a/src/Rtmp/Rtmp.h +++ b/src/Rtmp/Rtmp.h @@ -213,6 +213,10 @@ private: RtmpPacket(){ clear(); } + +private: + //对象个数统计 + ObjectStatistic _statistic; }; /** diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index 70242a20..2d2c6d13 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -545,4 +545,8 @@ RtpPacket::Ptr RtpPacket::create(){ #endif } -}//namespace mediakit \ No newline at end of file +}//namespace mediakit + +namespace toolkit { + StatisticImp(mediakit::RtpPacket); +} \ No newline at end of file diff --git a/src/Rtsp/Rtsp.h b/src/Rtsp/Rtsp.h index 8b4f2508..4bf884d5 100644 --- a/src/Rtsp/Rtsp.h +++ b/src/Rtsp/Rtsp.h @@ -172,6 +172,10 @@ public: private: friend class ResourcePool_l; RtpPacket() = default; + +private: + //对象个数统计 + ObjectStatistic _statistic; }; class RtpPayload {