rtmp播放时,取相对时间戳逻辑确保时间戳同步

This commit is contained in:
xiongziliang
2020-05-06 18:54:28 +08:00
parent 920f06a996
commit a4d7b3463e
4 changed files with 54 additions and 4 deletions

View File

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

View File

@@ -266,6 +266,8 @@ void RtmpSession::sendPlayResponse(const string &err,const RtmpMediaSource::Ptr
onSendMedia(pkt);
});
//音频同步于视频
_stamp[0].makeRelation( _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) {