mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #299, refine code.
This commit is contained in:
parent
62b7204514
commit
f32aab3d92
175 changed files with 15529 additions and 15935 deletions
|
@ -1,33 +1,29 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2017 SRS(ossrs)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2017 SRS(ossrs)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_APP_STATISTIC_HPP
|
||||
#define SRS_APP_STATISTIC_HPP
|
||||
|
||||
/*
|
||||
#include <srs_app_statistic.hpp>
|
||||
*/
|
||||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#include <map>
|
||||
|
@ -52,8 +48,8 @@ public:
|
|||
int nb_clients;
|
||||
public:
|
||||
/**
|
||||
* vhost total kbps.
|
||||
*/
|
||||
* vhost total kbps.
|
||||
*/
|
||||
SrsKbps* kbps;
|
||||
public:
|
||||
SrsStatisticVhost();
|
||||
|
@ -75,8 +71,8 @@ public:
|
|||
int nb_clients;
|
||||
public:
|
||||
/**
|
||||
* stream total kbps.
|
||||
*/
|
||||
* stream total kbps.
|
||||
*/
|
||||
SrsKbps* kbps;
|
||||
public:
|
||||
bool has_video;
|
||||
|
@ -94,11 +90,11 @@ public:
|
|||
SrsAudioSampleRate asample_rate;
|
||||
SrsAudioChannels asound_type;
|
||||
/**
|
||||
* audio specified
|
||||
* audioObjectType, in 1.6.2.1 AudioSpecificConfig, page 33,
|
||||
* 1.5.1.1 Audio object type definition, page 23,
|
||||
* in ISO_IEC_14496-3-AAC-2001.pdf.
|
||||
*/
|
||||
* audio specified
|
||||
* audioObjectType, in 1.6.2.1 AudioSpecificConfig, page 33,
|
||||
* 1.5.1.1 Audio object type definition, page 23,
|
||||
* in ISO_IEC_14496-3-AAC-2001.pdf.
|
||||
*/
|
||||
SrsAacObjectType aac_object;
|
||||
public:
|
||||
SrsStatisticStream();
|
||||
|
@ -107,12 +103,12 @@ public:
|
|||
virtual int dumps(SrsJsonObject* obj);
|
||||
public:
|
||||
/**
|
||||
* publish the stream.
|
||||
*/
|
||||
* publish the stream.
|
||||
*/
|
||||
virtual void publish(int cid);
|
||||
/**
|
||||
* close the stream.
|
||||
*/
|
||||
* close the stream.
|
||||
*/
|
||||
virtual void close();
|
||||
};
|
||||
|
||||
|
@ -167,19 +163,13 @@ public:
|
|||
virtual SrsStatisticClient* find_client(int cid);
|
||||
public:
|
||||
/**
|
||||
* when got video info for stream.
|
||||
*/
|
||||
virtual int on_video_info(SrsRequest* req,
|
||||
SrsVideoCodecId vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level,
|
||||
int width, int height
|
||||
);
|
||||
* when got video info for stream.
|
||||
*/
|
||||
virtual int on_video_info(SrsRequest* req, SrsVideoCodecId vcodec, SrsAvcProfile avc_profile, SrsAvcLevel avc_level, int width, int height);
|
||||
/**
|
||||
* when got audio info for stream.
|
||||
*/
|
||||
virtual int on_audio_info(SrsRequest* req,
|
||||
SrsAudioCodecId acodec, SrsAudioSampleRate asample_rate, SrsAudioChannels asound_type,
|
||||
SrsAacObjectType aac_object
|
||||
);
|
||||
* when got audio info for stream.
|
||||
*/
|
||||
virtual int on_audio_info(SrsRequest* req, SrsAudioCodecId acodec, SrsAudioSampleRate asample_rate, SrsAudioChannels asound_type, SrsAacObjectType aac_object);
|
||||
/**
|
||||
* when publish stream.
|
||||
* @param req the request object of publish connection.
|
||||
|
@ -187,8 +177,8 @@ public:
|
|||
*/
|
||||
virtual void on_stream_publish(SrsRequest* req, int cid);
|
||||
/**
|
||||
* when close stream.
|
||||
*/
|
||||
* when close stream.
|
||||
*/
|
||||
virtual void on_stream_close(SrsRequest* req);
|
||||
public:
|
||||
/**
|
||||
|
@ -207,29 +197,29 @@ public:
|
|||
*/
|
||||
virtual void on_disconnect(int id);
|
||||
/**
|
||||
* sample the kbps, add delta bytes of conn.
|
||||
* use kbps_sample() to get all result of kbps stat.
|
||||
*/
|
||||
* sample the kbps, add delta bytes of conn.
|
||||
* use kbps_sample() to get all result of kbps stat.
|
||||
*/
|
||||
// TODO: FIXME: the add delta must use IKbpsDelta interface instead.
|
||||
virtual void kbps_add_delta(SrsConnection* conn);
|
||||
/**
|
||||
* calc the result for all kbps.
|
||||
* @return the server kbps.
|
||||
*/
|
||||
* calc the result for all kbps.
|
||||
* @return the server kbps.
|
||||
*/
|
||||
virtual SrsKbps* kbps_sample();
|
||||
public:
|
||||
/**
|
||||
* get the server id, used to identify the server.
|
||||
* for example, when restart, the server id must changed.
|
||||
*/
|
||||
* get the server id, used to identify the server.
|
||||
* for example, when restart, the server id must changed.
|
||||
*/
|
||||
virtual int64_t server_id();
|
||||
/**
|
||||
* dumps the vhosts to amf0 array.
|
||||
*/
|
||||
* dumps the vhosts to amf0 array.
|
||||
*/
|
||||
virtual int dumps_vhosts(SrsJsonArray* arr);
|
||||
/**
|
||||
* dumps the streams to amf0 array.
|
||||
*/
|
||||
* dumps the streams to amf0 array.
|
||||
*/
|
||||
virtual int dumps_streams(SrsJsonArray* arr);
|
||||
/**
|
||||
* dumps the clients to amf0 array
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue