Skip to content

Commit

Permalink
Fix lifetime issue in add_transceiver_from_track
Browse files Browse the repository at this point in the history
  • Loading branch information
lookback-hugotunius authored and rainliu committed Dec 15, 2021
1 parent 668445c commit fc7e1ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/peer_connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1693,10 +1693,10 @@ impl RTCPeerConnection {
}

/// add_transceiver_from_track Create a new RtpTransceiver(SendRecv or SendOnly) and add it to the set of transceivers.
pub async fn add_transceiver_from_track(
&self,
track: &Arc<dyn TrackLocal + Send + Sync>, //Why compiler complains if "track: Arc<dyn TrackLocal + Send + Sync>"?
init: &[RTCRtpTransceiverInit],
pub async fn add_transceiver_from_track<'a>(
&'a self,
track: Arc<dyn TrackLocal + Send + Sync>,
init: &'a [RTCRtpTransceiverInit],
) -> Result<Arc<RTCRtpTransceiver>> {
if self.internal.is_closed.load(Ordering::SeqCst) {
return Err(Error::ErrConnectionClosed);
Expand All @@ -1710,7 +1710,7 @@ impl RTCPeerConnection {

let t = self
.internal
.new_transceiver_from_track(direction, Arc::clone(track))
.new_transceiver_from_track(direction, track)
.await?;

self.internal.add_rtp_transceiver(Arc::clone(&t)).await;
Expand Down

0 comments on commit fc7e1ef

Please sign in to comment.