srs-bench
srs-bench copied to clipboard
hls的测试用例在做统计时,计算问题请教
`int StHlsTask::ProcessTask(){ int ret = ERROR_SUCCESS;
Trace("start to process HLS task #%d, schema=%s, host=%s, port=%d, path=%s, startup=%.2f, delay=%.2f, error=%.2f, count=%d",
GetId(), url.GetSchema(), url.GetHost(), url.GetPort(), url.GetPath(), startup_seconds, delay_seconds, error_seconds, count);
// if count is zero, infinity loop.
for(int i = 0; count == 0 || i < count; i++){
statistic->OnTaskStart(GetId(), url.GetUrl());
StHttpClient client;
if((ret = ProcessM3u8(client)) != ERROR_SUCCESS){
statistic->OnTaskError(GetId(), 0);
Error("http client process m3u8 failed. ret=%d", ret);
st_usleep((st_utime_t)(error_seconds * 1000 * 1000));
continue;
}
Info("[HLS] %s download completed.", url.GetUrl());
}
return ret;
}`
这个代码片段中,在正常流程分支里,只调用了OnTaskStart没有调用OnTaskEnd,导致在跑的过程中,统计数据的alive等参数一直在累加没有任何变化。
想问一下,有没有为何这样做?遗漏,还是有什么原因。我现在也刚好正在找一些测试方法。