Skip to content

Commit

Permalink
Merge pull request #1023 from wusspuss/master
Browse files Browse the repository at this point in the history
Forward RTP/RTCP messages unconditionally if there is only one track
  • Loading branch information
paullouisageneau authored Nov 13, 2023
2 parents d8c63d6 + 61116cf commit 3681569
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 3681569

Please sign in to comment.