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

RTC: Refine error pithy print log

This commit is contained in:
winlin 2020-08-12 17:07:37 +08:00
parent ea10d7907f
commit 9d08318581
4 changed files with 28 additions and 14 deletions

View file

@ -36,6 +36,7 @@ SrsStageInfo::SrsStageInfo(int _stage_id)
stage_id = _stage_id;
nb_clients = 0;
age = 0;
nn_count = 0;
update_print_time();
@ -123,19 +124,25 @@ SrsErrorPithyPrint::~SrsErrorPithyPrint()
{
}
bool SrsErrorPithyPrint::can_print(srs_error_t err)
bool SrsErrorPithyPrint::can_print(srs_error_t err, uint32_t* pnn)
{
int error_code = srs_error_code(err);
return can_print(error_code);
return can_print(error_code, pnn);
}
bool SrsErrorPithyPrint::can_print(int error_code)
bool SrsErrorPithyPrint::can_print(int error_code, uint32_t* pnn)
{
nn_count++;
bool new_stage = false;
SrsStageInfo* stage = stages.fetch_or_create(error_code, &new_stage);
// Increase the count.
stage->nn_count++;
nn_count++;
if (pnn) {
*pnn = stage->nn_count;
}
// Always and only one client.
if (new_stage) {
stage->nb_clients = 1;