解决ws-flv和http-flv的累积时延问题(#2509)

This commit is contained in:
百鸣 2023-05-31 23:16:16 +08:00 committed by GitHub
parent 11a39c68c4
commit 14537bfbc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,9 +147,15 @@ bool HttpSession::checkWebSocket(){
_live_over_websocket = true;
sendResponse(101, false, nullptr, headerOut, nullptr, true);
};
auto res_cb_flv = [this, header = std::move(headerOut)]() mutable {
_live_over_websocket = true;
header.emplace("Cache-Control", "no-store");
sendResponse(101, false, nullptr, header, nullptr, true);
};
//判断是否为websocket-flv
if (checkLiveStreamFlv(res_cb)) {
if (checkLiveStreamFlv(res_cb_flv)) {
//这里是websocket-flv直播请求
return true;
}
@ -349,7 +355,9 @@ bool HttpSession::checkLiveStreamFlv(const function<void()> &cb){
assert(rtmp_src);
if (!cb) {
//找到源发送http头负载后续发送
sendResponse(200, false, HttpFileManager::getContentType(".flv").data(), KeyValue(), nullptr, true);
KeyValue headerOut;
headerOut["Cache-Control"] = "no-store";
sendResponse(200, false, HttpFileManager::getContentType(".flv").data(), headerOut, nullptr, true);
} else {
//自定义发送http头
cb();