优化音视频同步

This commit is contained in:
xiongziliang
2020-05-15 18:08:54 +08:00
parent 0779a4bee6
commit 1970f6014e
10 changed files with 117 additions and 33 deletions

View File

@@ -52,7 +52,7 @@ void FlvMuxer::start(const EventPoller::Ptr &poller,const RtmpMediaSource::Ptr &
});
//音频同步于视频
_stamp[0].makeRelation( _stamp[1]);
_stamp[0].syncTo(_stamp[1]);
_ring_reader->setReadCB([weakSelf](const RtmpMediaSource::RingDataType &pkt){
auto strongSelf = weakSelf.lock();
if(!strongSelf){

View File

@@ -267,7 +267,7 @@ void RtmpSession::sendPlayResponse(const string &err,const RtmpMediaSource::Ptr
});
//音频同步于视频
_stamp[0].makeRelation( _stamp[1]);
_stamp[0].syncTo(_stamp[1]);
_pRingReader = src->getRing()->attach(getPoller());
weak_ptr<RtmpSession> weakSelf = dynamic_pointer_cast<RtmpSession>(shared_from_this());
_pRingReader->setReadCB([weakSelf](const RtmpMediaSource::RingDataType &pkt) {