Skip to content

Make RTCPeerConnection::on_track spec-compliant #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

alexlapa
Copy link
Contributor

Currently RTCPeerConnection::on_track accepts OnTrackHdlrFn which is:

pub type OnTrackHdlrFn = Box<
    dyn (FnMut(
            Option<Arc<TrackRemote>>,
            Option<Arc<RTCRtpReceiver>>,
        ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>)
        + Send
        + Sync,
>;

When according to the WebRTc spec RTCTrackEvent is supposed to be:

interface RTCTrackEvent : Event {
  readonly attribute RTCRtpReceiver receiver;
  readonly attribute MediaStreamTrack track;
  [SameObject] readonly attribute FrozenArray<MediaStream> streams;
  readonly attribute RTCRtpTransceiver transceiver;
};

So, excluding MediaStreams, since i don't see it being used anywhere, this callback is supposed to look like this:

pub type OnTrackHdlrFn = Box<
    dyn (FnMut(
            Arc<TrackRemote>,
            Arc<RTCRtpReceiver>,
            Arc<RTCRtpTransceiver>,
        ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>)
        + Send
        + Sync,
>;

@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Base: 59.84% // Head: 60.10% // Increases project coverage by +0.25% 🎉

Coverage data is based on head (1099a3d) compared to base (acef878).
Patch coverage: 10.95% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #355      +/-   ##
==========================================
+ Coverage   59.84%   60.10%   +0.25%     
==========================================
  Files         503      503              
  Lines       47652    47983     +331     
  Branches    12358    12492     +134     
==========================================
+ Hits        28516    28838     +322     
- Misses       9905     9920      +15     
+ Partials     9231     9225       -6     
Impacted Files Coverage Δ
examples/examples/broadcast/broadcast.rs 0.00% <0.00%> (ø)
examples/examples/reflect/reflect.rs 0.00% <0.00%> (ø)
examples/examples/rtp-forwarder/rtp-forwarder.rs 0.00% <0.00%> (ø)
...es/examples/save-to-disk-h264/save-to-disk-h264.rs 0.00% <0.00%> (ø)
...ples/examples/save-to-disk-vpx/save-to-disk-vpx.rs 0.00% <0.00%> (ø)
examples/examples/simulcast/simulcast.rs 0.00% <0.00%> (ø)
examples/examples/swap-tracks/swap-tracks.rs 0.00% <0.00%> (ø)
.../src/rtp_transceiver/rtp_sender/rtp_sender_test.rs 55.14% <9.37%> (+0.82%) ⬆️
webrtc/src/peer_connection/peer_connection_test.rs 63.56% <41.66%> (+0.61%) ⬆️
.../rtp_transceiver/rtp_receiver/rtp_receiver_test.rs 57.69% <50.00%> (+0.41%) ⬆️
... and 106 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alexlapa
Copy link
Contributor Author

alexlapa commented Dec 1, 2022

Compile and test with minimal versions CI step also fails on current master, so i don't think it is relevant to this PR.

@alexlapa alexlapa marked this pull request as ready for review December 1, 2022 12:09
@k0nserv k0nserv merged commit 20b59b7 into webrtc-rs:master Dec 2, 2022
@k0nserv
Copy link
Member

k0nserv commented Dec 2, 2022

Noice 👍🏼

@alexlapa alexlapa deleted the fix-ontrack branch December 3, 2022 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants