Skip to content

Commit fc7e1ef

Browse files
lookback-hugotuniusrainliu
authored andcommitted
Fix lifetime issue in add_transceiver_from_track
1 parent 668445c commit fc7e1ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/peer_connection/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,10 +1693,10 @@ impl RTCPeerConnection {
16931693
}
16941694

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

17111711
let t = self
17121712
.internal
1713-
.new_transceiver_from_track(direction, Arc::clone(track))
1713+
.new_transceiver_from_track(direction, track)
17141714
.await?;
17151715

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

0 commit comments

Comments
 (0)