mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
解决ws-flv和http-flv的累积时延问题(#2509)
This commit is contained in:
parent
11a39c68c4
commit
14537bfbc7
@ -147,9 +147,15 @@ bool HttpSession::checkWebSocket(){
|
|||||||
_live_over_websocket = true;
|
_live_over_websocket = true;
|
||||||
sendResponse(101, false, nullptr, headerOut, nullptr, 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
|
//判断是否为websocket-flv
|
||||||
if (checkLiveStreamFlv(res_cb)) {
|
if (checkLiveStreamFlv(res_cb_flv)) {
|
||||||
//这里是websocket-flv直播请求
|
//这里是websocket-flv直播请求
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -349,7 +355,9 @@ bool HttpSession::checkLiveStreamFlv(const function<void()> &cb){
|
|||||||
assert(rtmp_src);
|
assert(rtmp_src);
|
||||||
if (!cb) {
|
if (!cb) {
|
||||||
//找到源,发送http头,负载后续发送
|
//找到源,发送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 {
|
} else {
|
||||||
//自定义发送http头
|
//自定义发送http头
|
||||||
cb();
|
cb();
|
||||||
|
Loading…
Reference in New Issue
Block a user