Skip to content

Commit 4bb9614

Browse files
authored
rtp_receiver: Get rid of fields already in internal (webrtc-rs#592)
No need to store kind and transport, as they are already stored by RTPReceiverInternal.
1 parent 40642c8 commit 4bb9614

File tree

1 file changed

+8
-10
lines changed
  • webrtc/src/rtp_transceiver/rtp_receiver

1 file changed

+8
-10
lines changed

webrtc/src/rtp_transceiver/rtp_receiver/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,14 @@ impl RTPReceiverInternal {
401401
/// [W3C]: https://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface
402402
pub struct RTCRtpReceiver {
403403
receive_mtu: usize,
404-
kind: RTPCodecType,
405-
transport: Arc<RTCDtlsTransport>,
406404

407405
pub internal: Arc<RTPReceiverInternal>,
408406
}
409407

410408
impl std::fmt::Debug for RTCRtpReceiver {
411409
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
412410
f.debug_struct("RTCRtpReceiver")
413-
.field("kind", &self.kind)
411+
.field("kind", &self.internal.kind)
414412
.finish()
415413
}
416414
}
@@ -427,8 +425,6 @@ impl RTCRtpReceiver {
427425

428426
RTCRtpReceiver {
429427
receive_mtu,
430-
kind,
431-
transport: Arc::clone(&transport),
432428

433429
internal: Arc::new(RTPReceiverInternal {
434430
kind,
@@ -447,7 +443,7 @@ impl RTCRtpReceiver {
447443
}
448444

449445
pub fn kind(&self) -> RTPCodecType {
450-
self.kind
446+
self.internal.kind
451447
}
452448

453449
pub(crate) fn set_transceiver_codecs(
@@ -460,7 +456,7 @@ impl RTCRtpReceiver {
460456
/// transport returns the currently-configured *DTLSTransport or nil
461457
/// if one has not yet been configured
462458
pub fn transport(&self) -> Arc<RTCDtlsTransport> {
463-
Arc::clone(&self.transport)
459+
Arc::clone(&self.internal.transport)
464460
}
465461

466462
/// get_parameters describes the current configuration for the encoding and
@@ -539,7 +535,8 @@ impl RTCRtpReceiver {
539535
&global_params.header_extensions,
540536
);
541537
let (rtp_read_stream, rtp_interceptor, rtcp_read_stream, rtcp_interceptor) =
542-
self.transport
538+
self.internal
539+
.transport
543540
.streams_for_ssrc(encoding.ssrc, &stream_info, &interceptor)
544541
.await?;
545542

@@ -557,7 +554,7 @@ impl RTCRtpReceiver {
557554
let t = TrackStreams {
558555
track: Arc::new(TrackRemote::new(
559556
self.receive_mtu,
560-
self.kind,
557+
self.internal.kind,
561558
encoding.ssrc,
562559
encoding.rid.clone(),
563560
receiver.clone(),
@@ -596,6 +593,7 @@ impl RTCRtpReceiver {
596593
&global_params.header_extensions,
597594
);
598595
let (rtp_read_stream, rtp_interceptor, rtcp_read_stream, rtcp_interceptor) = self
596+
.internal
599597
.transport
600598
.streams_for_ssrc(rtx_ssrc, &stream_info, &interceptor)
601599
.await?;
@@ -766,7 +764,7 @@ impl RTCRtpReceiver {
766764
let mut tracks = self.internal.tracks.write().await;
767765
for t in &mut *tracks {
768766
if *t.track.rid() == rid {
769-
t.track.set_kind(self.kind);
767+
t.track.set_kind(self.internal.kind);
770768
if let Some(codec) = params.codecs.first() {
771769
t.track.set_codec(codec.clone());
772770
}

0 commit comments

Comments
 (0)