diff --git a/trunk/src/app/srs_app_pithy_print.cpp b/trunk/src/app/srs_app_pithy_print.cpp index 3b53891b9..64b320098 100644 --- a/trunk/src/app/srs_app_pithy_print.cpp +++ b/trunk/src/app/srs_app_pithy_print.cpp @@ -31,12 +31,13 @@ using namespace std; #include #include -SrsStageInfo::SrsStageInfo(int _stage_id) +SrsStageInfo::SrsStageInfo(int _stage_id, double ratio) { stage_id = _stage_id; nb_clients = 0; age = 0; nn_count = 0; + interval_ratio = ratio; update_print_time(); @@ -50,7 +51,7 @@ SrsStageInfo::~SrsStageInfo() void SrsStageInfo::update_print_time() { - interval = _srs_config->get_pithy_print(); + interval = (srs_utime_t)(interval_ratio * _srs_config->get_pithy_print()); } void SrsStageInfo::elapse(srs_utime_t diff) @@ -115,9 +116,10 @@ SrsStageInfo* SrsStageManager::fetch_or_create(int stage_id, bool* pnew) return stage; } -SrsErrorPithyPrint::SrsErrorPithyPrint() +SrsErrorPithyPrint::SrsErrorPithyPrint(double ratio) { nn_count = 0; + ratio_ = ratio; } SrsErrorPithyPrint::~SrsErrorPithyPrint() @@ -146,6 +148,7 @@ bool SrsErrorPithyPrint::can_print(int error_code, uint32_t* pnn) // Always and only one client. if (new_stage) { stage->nb_clients = 1; + stage->interval_ratio = ratio_; } srs_utime_t tick = ticks[error_code]; diff --git a/trunk/src/app/srs_app_pithy_print.hpp b/trunk/src/app/srs_app_pithy_print.hpp index c88478c0b..0fa3b6da2 100644 --- a/trunk/src/app/srs_app_pithy_print.hpp +++ b/trunk/src/app/srs_app_pithy_print.hpp @@ -39,10 +39,12 @@ public: int nb_clients; // The number of call of can_print(). uint32_t nn_count; + // The ratio for interval, 1.0 means no change. + double interval_ratio; public: srs_utime_t age; public: - SrsStageInfo(int _stage_id); + SrsStageInfo(int _stage_id, double ratio = 1.0); virtual ~SrsStageInfo(); virtual void update_print_time(); public: @@ -74,10 +76,11 @@ public: // The number of call of can_print(). uint32_t nn_count; private: + double ratio_; SrsStageManager stages; std::map ticks; public: - SrsErrorPithyPrint(); + SrsErrorPithyPrint(double ratio = 1.0); virtual ~SrsErrorPithyPrint(); public: // Whether specified stage is ready for print.