mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
完善录制相关功能
This commit is contained in:
parent
cc2d22737f
commit
8ebf127ee6
@ -185,6 +185,9 @@ static onceToken s_token([](){
|
||||
if(schema == RTMP_SCHEMA && app == "live"){
|
||||
static map<string,FlvRecorder::Ptr> s_mapFlvRecorder;
|
||||
static mutex s_mtxFlvRecorder;
|
||||
auto poller = EventPollerPool::Instance().getPoller();
|
||||
auto rtmpMediaSrc = dynamic_pointer_cast<RtmpMediaSource>(sender.shared_from_this());
|
||||
poller->async([bRegist,schema,vhost,app,stream,poller,rtmpMediaSrc](){
|
||||
lock_guard<mutex> lck(s_mtxFlvRecorder);
|
||||
if(bRegist){
|
||||
DebugL << "开始录制RTMP:" << schema << " " << vhost << " " << app << " " << stream;
|
||||
@ -192,7 +195,7 @@ static onceToken s_token([](){
|
||||
auto path = http_root + "/" + vhost + "/" + app + "/" + stream + "_" + to_string(time(NULL)) + ".flv";
|
||||
FlvRecorder::Ptr recorder(new FlvRecorder);
|
||||
try{
|
||||
recorder->startRecord(nullptr,dynamic_pointer_cast<RtmpMediaSource>(sender.shared_from_this()),path);
|
||||
recorder->startRecord(poller,rtmpMediaSrc,path);
|
||||
s_mapFlvRecorder[vhost + "/" + app + "/" + stream] = recorder;
|
||||
}catch(std::exception &ex){
|
||||
WarnL << ex.what();
|
||||
@ -200,6 +203,7 @@ static onceToken s_token([](){
|
||||
}else{
|
||||
s_mapFlvRecorder.erase(vhost + "/" + app + "/" + stream);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user