Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check audio/video track when rtc stream updated #2418

Merged
merged 1 commit into from
Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,22 +455,26 @@ void SrsRtcPlayStream::on_stream_change(SrsRtcSourceDescription* desc)
// Refresh the relation for audio.
// TODO: FIMXE: Match by label?
if (desc && desc->audio_track_desc_ && audio_tracks_.size() == 1) {
uint32_t ssrc = desc->audio_track_desc_->ssrc_;
SrsRtcAudioSendTrack* track = audio_tracks_.begin()->second;
if (! audio_tracks_.empty()) {
uint32_t ssrc = desc->audio_track_desc_->ssrc_;
SrsRtcAudioSendTrack* track = audio_tracks_.begin()->second;

audio_tracks_.clear();
audio_tracks_.insert(make_pair(ssrc, track));
audio_tracks_.clear();
audio_tracks_.insert(make_pair(ssrc, track));
}
}

// Refresh the relation for video.
// TODO: FIMXE: Match by label?
if (desc && desc->video_track_descs_.size() == 1) {
SrsRtcTrackDescription* vdesc = desc->video_track_descs_.at(0);
uint32_t ssrc = vdesc->ssrc_;
SrsRtcVideoSendTrack* track = video_tracks_.begin()->second;
if (! video_tracks_.empty()) {
SrsRtcTrackDescription* vdesc = desc->video_track_descs_.at(0);
uint32_t ssrc = vdesc->ssrc_;
SrsRtcVideoSendTrack* track = video_tracks_.begin()->second;

video_tracks_.clear();
video_tracks_.insert(make_pair(ssrc, track));
video_tracks_.clear();
video_tracks_.insert(make_pair(ssrc, track));
}
}
}

Expand Down