rtp send rtp g711 audio can config duration (#3325)

optimization for this
[issue](https://github.com/ZLMediaKit/ZLMediaKit/issues/3316)
This commit is contained in:
xiongguangjie
2024-03-02 16:40:13 +08:00
committed by GitHub
parent 87cb488b04
commit 06abbd0eb7
7 changed files with 50 additions and 7 deletions

View File

@@ -34,6 +34,12 @@ bool RawEncoderImp::addTrack(const Track::Ptr &track) {
auto ring = std::make_shared<RtpRing::RingType>();
ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), true); }));
_rtp_encoder->setRtpRing(std::move(ring));
if (track->getCodecId() == CodecG711A || track->getCodecId() == CodecG711U) {
GET_CONFIG(uint32_t, dur_ms, RtpProxy::kRtpG711DurMs);
Any param;
param.set<uint32_t>(dur_ms);
_rtp_encoder->setOpt(RtpCodec::RTP_ENCODER_PKT_DUR_MS, param);
}
return true;
}