From 68fc3bdcf8b402a2157a4682566b88c31d2a5c39 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 23 Oct 2018 22:27:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84rtsp=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspSdp.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Rtsp/RtspSdp.h b/src/Rtsp/RtspSdp.h index a2da3815..72c0b123 100644 --- a/src/Rtsp/RtspSdp.h +++ b/src/Rtsp/RtspSdp.h @@ -289,7 +289,7 @@ public: virtual ~RtspMaker(){} /** - * 添加音视频track + * 添加音视频或title 媒体 * @param sdp 媒体描述对象 * @param ssrc 媒体rtp ssrc * @param mtu 媒体rtp mtu @@ -305,6 +305,23 @@ public: } + /** + * 添加音视频或title 媒体 + * @param track 媒体描述 + * @param ssrc 媒体rtp ssrc + * @param mtu 媒体rtp mtu + */ + void addTrack(const Track::Ptr & track,uint32_t ssrc = 0,int mtu = 1400) { + if(track->getCodecId() == CodecInvalid){ + addTrack(std::make_shared(),ssrc,mtu); + } else { + Sdp::Ptr sdp = Sdp::getSdpByTrack(track); + if(sdp){ + addTrack(sdp,ssrc,mtu); + } + } + } + /** * 获取完整的SDP字符串 * @return SDP字符串