flv录制延时两秒启动,防止收集config帧不齐

This commit is contained in:
xiongziliang 2019-05-27 10:58:08 +08:00
parent 6ef5ae0f3c
commit c857968f40
2 changed files with 4 additions and 2 deletions

@ -1 +1 @@
Subproject commit 02d8b5df6a93cc84b605a548220fd552061e66c5 Subproject commit f9297f31e570e4ca6f3ab1bee32eadebfbee1c1f

View File

@ -44,11 +44,13 @@ void FlvMuxer::start(const EventPoller::Ptr &poller,const RtmpMediaSource::Ptr &
} }
if(!poller->isCurrentThread()){ if(!poller->isCurrentThread()){
weak_ptr<FlvMuxer> weakSelf = getSharedPtr(); weak_ptr<FlvMuxer> weakSelf = getSharedPtr();
poller->async([weakSelf,poller,media](){ //延时两秒启动录制目的是为了等待config帧收集完毕
poller->doDelayTask(2000,[weakSelf,poller,media](){
auto strongSelf = weakSelf.lock(); auto strongSelf = weakSelf.lock();
if(strongSelf){ if(strongSelf){
strongSelf->start(poller,media); strongSelf->start(poller,media);
} }
return 0;
}); });
return; return;
} }