hls拉流动态计算切片超时时间 (#1477)

* 动态计算切片超时时间

设置最大超时时间倍数和最小倍数,然后根据上一个切片的下载情况动态增加或者减少切片的超时时间.

* Update HlsPlayer.cpp
This commit is contained in:
alexliyu7352
2022-03-12 09:39:33 +08:00
committed by GitHub
parent b4241e12d5
commit 276f763c08
2 changed files with 11 additions and 2 deletions

View File

@@ -17,6 +17,9 @@
#include "HlsParser.h"
#include "Rtp/TSDecoder.h"
#define MIN_TIMEOUT_MULTIPLE 2
#define MAX_TIMEOUT_MULTIPLE 5
namespace mediakit {
class HlsDemuxer : public MediaSinkInterface , public TrackSource, public std::enable_shared_from_this<HlsDemuxer> {
@@ -101,6 +104,7 @@ private:
std::list<std::string> _ts_url_sort;
std::set<std::string, UrlComp> _ts_url_cache;
HttpTSPlayer::Ptr _http_ts_player;
int _timeout_multiple = MIN_TIMEOUT_MULTIPLE;
};
class HlsPlayerImp : public PlayerImp<HlsPlayer, PlayerBase>, private TrackListener {