Commit a390042f by xiongguangjie

srt push check audio and video timestamp sync

parent ca7efd59
......@@ -288,6 +288,14 @@ bool SrtTransportImp::inputFrame(const Frame::Ptr &frame) {
if (_muxer) {
//TraceL<<"before type "<<frame->getCodecName()<<" dts "<<frame->dts()<<" pts "<<frame->pts();
auto frame_tmp = std::make_shared<FrameStamp>(frame, _type_to_stamp[frame->getTrackType()],false);
if(_type_to_stamp.size()>1){
// 有音视频,检查是否时间戳是否差距过大
auto diff = _type_to_stamp[TrackType::TrackVideo].getRelativeStamp() - _type_to_stamp[TrackType::TrackAudio].getRelativeStamp();
if(std::abs(diff) > 5000){
// 超过5s,应该同步 TODO
WarnL << _media_info._full_url<<" video or audio not sync : "<<diff;
}
}
//TraceL<<"after type "<<frame_tmp->getCodecName()<<" dts "<<frame_tmp->dts()<<" pts "<<frame_tmp->pts();
return _muxer->inputFrame(frame_tmp);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论