Skip to content

Commit

Permalink
fix: anchor track forward,subscription lock,read update to try_read
Browse files Browse the repository at this point in the history
  • Loading branch information
hongcha98 committed Nov 2, 2023
1 parent 66398c0 commit b268c04
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/forward/forward_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,12 @@ impl PeerForwardInternal {
track.ssrc()
);
while let Ok((rtp_packet, _)) = track.read(&mut b).await {
let anchor_track_forward = subscription.read().await;
let packet = Arc::new(rtp_packet);
for (peer_wrap, sender) in anchor_track_forward.iter() {
if peer_wrap.0.connection_state() == RTCPeerConnectionState::Connected {
let _ = sender.send(packet.clone());
if let Ok(anchor_track_forward) = subscription.try_read() {
let packet = Arc::new(rtp_packet);
for (peer_wrap, sender) in anchor_track_forward.iter() {
if peer_wrap.0.connection_state() == RTCPeerConnectionState::Connected {
let _ = sender.send(packet.clone());
}
}
}
}
Expand Down

0 comments on commit b268c04

Please sign in to comment.