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

Forward RTP/RTCP messages unconditionally if there is only one track #1023

Merged
merged 2 commits into from
Nov 13, 2023
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
8 changes: 6 additions & 2 deletions src/impl/peerconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,12 @@ void PeerConnection::forwardMedia([[maybe_unused]] message_ptr message) {

void PeerConnection::dispatchMedia([[maybe_unused]] message_ptr message) {
#if RTC_ENABLE_MEDIA
std::shared_lock lock(mTracksMutex); // read-only
if (mTrackLines.size()==1) {
if (auto track = mTrackLines.front().lock())
track->incoming(message);
return;
}
// Browsers like to compound their packets with a random SSRC.
// we have to do this monstrosity to distribute the report blocks
if (message->type == Message::Control) {
Expand Down Expand Up @@ -568,7 +574,6 @@ void PeerConnection::dispatchMedia([[maybe_unused]] message_ptr message) {
}

if (!ssrcs.empty()) {
std::shared_lock lock(mTracksMutex); // read-only
for (uint32_t ssrc : ssrcs) {
if (auto it = mTracksBySsrc.find(ssrc); it != mTracksBySsrc.end()) {
if (auto track = it->second.lock())
Expand All @@ -581,7 +586,6 @@ void PeerConnection::dispatchMedia([[maybe_unused]] message_ptr message) {

uint32_t ssrc = uint32_t(message->stream);

std::shared_lock lock(mTracksMutex); // read-only
if (auto it = mTracksBySsrc.find(ssrc); it != mTracksBySsrc.end()) {
if (auto track = it->second.lock())
track->incoming(message);
Expand Down
Loading