Compare commits

...

5 Commits

Author SHA1 Message Date
imp_rayjay
92e1e46642
Merge 6119ac9c53 into 226b87a633 2024-11-18 14:18:18 +08:00
ss002012
226b87a633
优化rtsp ntp时间戳,防止音视频不同步( #4017 #4018)
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
rtp时间戳可能被截断,ntp时间戳生成时优先使用未截断的原始时间戳,防止音视频不同步
2024-11-18 14:08:53 +08:00
rayjay
6119ac9c53 rtp推流增加PCM音频的处理 2024-03-28 11:21:23 +08:00
rayjay
a33c1d5a08 Merge branch 'master' of https://github.com/ZLMediaKit/ZLMediaKit 2024-03-28 11:15:19 +08:00
rayjay
e7e157c312 打包mjepg rtp的时候增加支持DRI(原先只在解包的时候支持,打包的时候并不支持) 2024-02-19 11:20:06 +08:00
2 changed files with 11 additions and 2 deletions

View File

@ -105,6 +105,16 @@ bool GB28181Process::inputRtp(bool, const char *data, size_t data_len) {
_rtp_decoder[pt] = Factory::getRtpDecoderByCodecId(track->getCodecId()); _rtp_decoder[pt] = Factory::getRtpDecoderByCodecId(track->getCodecId());
break; break;
} }
case Rtsp::PT_L16_Mono: {
//L16
ref = std::make_shared<RtpReceiverImp>(16000, [this](RtpPacket::Ptr rtp) { onRtpSorted(std::move(rtp)); });
auto track = Factory::getTrackByCodecId(CodecL16, 16000, 1, 16);
CHECK(track);
track->setIndex(pt);
_interface->addTrack(track);
_rtp_decoder[pt] = Factory::getRtpDecoderByCodecId(track->getCodecId());
break;
}
default: { default: {
if (pt == opus_pt) { if (pt == opus_pt) {
// opus负载 [AUTO-TRANSLATED:defa6a8d] // opus负载 [AUTO-TRANSLATED:defa6a8d]

View File

@ -23,11 +23,10 @@ void RtspMuxer::onRtp(RtpPacket::Ptr in, bool is_key) {
if (ref.rtp_stamp != in->getHeader()->stamp) { if (ref.rtp_stamp != in->getHeader()->stamp) {
// rtp时间戳变化才计算ntp节省cpu资源 [AUTO-TRANSLATED:729d54f2] // rtp时间戳变化才计算ntp节省cpu资源 [AUTO-TRANSLATED:729d54f2]
// Only calculate NTP when the RTP timestamp changes, saving CPU resources // Only calculate NTP when the RTP timestamp changes, saving CPU resources
int64_t stamp_ms = in->getStamp() * uint64_t(1000) / in->sample_rate;
int64_t stamp_ms_inc; int64_t stamp_ms_inc;
// 求rtp时间戳增量 [AUTO-TRANSLATED:f6ba022f] // 求rtp时间戳增量 [AUTO-TRANSLATED:f6ba022f]
// Get the RTP timestamp increment // Get the RTP timestamp increment
ref.stamp.revise(stamp_ms, stamp_ms, stamp_ms_inc, stamp_ms_inc); ref.stamp.revise(in->ntp_stamp, in->ntp_stamp, stamp_ms_inc, stamp_ms_inc);
ref.rtp_stamp = in->getHeader()->stamp; ref.rtp_stamp = in->getHeader()->stamp;
ref.ntp_stamp = stamp_ms_inc + _ntp_stamp_start; ref.ntp_stamp = stamp_ms_inc + _ntp_stamp_start;
} }