From c1b78629e13239688c2d1733724beadf3dcc0e5c Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Thu, 25 Nov 2021 20:42:51 +0800 Subject: [PATCH] fix rtc play signal stream only audio or video failed (#1239) --- webrtc/Sdp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp index 0831a1cf..82f28acf 100644 --- a/webrtc/Sdp.cpp +++ b/webrtc/Sdp.cpp @@ -1737,16 +1737,21 @@ RETRY: void RtcConfigure::setPlayRtspInfo(const string &sdp){ RtcSession session; + video.direction = RtpDirection::inactive; + audio.direction = RtpDirection::inactive; + session.loadFrom(sdp); for (auto &m : session.media) { switch (m.type) { case TrackVideo : { + video.direction = RtpDirection::sendonly; _rtsp_video_plan = std::make_shared(m.plan[0]); video.preferred_codec.clear(); video.preferred_codec.emplace_back(getCodecId(_rtsp_video_plan->codec)); break; } case TrackAudio : { + audio.direction = RtpDirection::sendonly; _rtsp_audio_plan = std::make_shared(m.plan[0]); audio.preferred_codec.clear(); audio.preferred_codec.emplace_back(getCodecId(_rtsp_audio_plan->codec));