From fc7e1ef9f9e7b5b6208abe808079bda23beb15c8 Mon Sep 17 00:00:00 2001 From: Hugo Tunius Date: Tue, 14 Dec 2021 16:40:00 +0000 Subject: [PATCH] Fix lifetime issue in `add_transceiver_from_track` --- src/peer_connection/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/peer_connection/mod.rs b/src/peer_connection/mod.rs index 8f75353a4..499a833db 100644 --- a/src/peer_connection/mod.rs +++ b/src/peer_connection/mod.rs @@ -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, //Why compiler complains if "track: Arc"? - init: &[RTCRtpTransceiverInit], + pub async fn add_transceiver_from_track<'a>( + &'a self, + track: Arc, + init: &'a [RTCRtpTransceiverInit], ) -> Result> { if self.internal.is_closed.load(Ordering::SeqCst) { return Err(Error::ErrConnectionClosed); @@ -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;