fix rtc play signal stream only audio or video failed (#1239)

This commit is contained in:
xiongguangjie 2021-11-25 20:42:51 +08:00 committed by GitHub
parent 5daf52cafd
commit c1b78629e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<RtcCodecPlan>(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<RtcCodecPlan>(m.plan[0]);
audio.preferred_codec.clear();
audio.preferred_codec.emplace_back(getCodecId(_rtsp_audio_plan->codec));