优化hls播放器,使用持久化连接 (#3070)

hls播放时,如果对方reset断开了tcp连接,应该自动发起重连
This commit is contained in:
alexliyu7352
2023-12-01 17:56:08 +08:00
committed by GitHub
parent 50281513d9
commit 4648c156c8
7 changed files with 176 additions and 102 deletions

View File

@@ -146,6 +146,13 @@ public:
*/
void setProxyUrl(std::string proxy_url);
/**
* 当重用连接失败时, 是否允许重新发起请求
* If the reuse connection fails, whether to allow the request to be resent
* @param allow true:允许重新发起请求 / true: allow the request to be resent
*/
void setAllowResendRequest(bool allow);
protected:
/**
* 收到http回复头
@@ -201,6 +208,8 @@ private:
//for http response
bool _complete = false;
bool _header_recved = false;
bool _http_persistent = true;
bool _allow_resend_request = false;
size_t _recved_body_size;
ssize_t _total_body_size;
Parser _parser;