Skip to content
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

Improve the structs in the API, add docs #104

Merged
merged 5 commits into from
May 9, 2024
Merged

Improve the structs in the API, add docs #104

merged 5 commits into from
May 9, 2024

Conversation

LVala
Copy link
Member

@LVala LVala commented May 8, 2024

This PR:

  • removes most of the stuff that should be private from RTPTransceiver, RTPSender and RTPReceiver structs (like the "recorder..." modules)
  • adds some getters to the PeerConnection (for the various states)
  • adds doc stubs to most of the function in the API in general

@LVala LVala self-assigned this May 8, 2024
@LVala LVala requested a review from mickel8 May 8, 2024 10:22
Copy link
Member

@mickel8 mickel8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coool 👍

"""
@type signaling_state() :: :stable | :have_local_offer | :have_remote_offer

@typedoc """
Possible PeerConnection states.
Messages sent by the the `ExWebRTC.PeerConnection` process to its controlling process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Messages sent by the the `ExWebRTC.PeerConnection` process to its controlling process.
Messages sent by the `ExWebRTC.PeerConnection` process to its controlling process.

) :: {:ok, RTPTransceiver.t()}
def add_transceiver(peer_connection, kind_or_track, options \\ []) do
GenServer.call(peer_connection, {:add_transceiver, kind_or_track, options})
end

@doc """
Sets the direction of transceiver specified by the `id`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at other functions too

Suggested change
Sets the direction of transceiver specified by the `id`.
Sets the direction of transceiver specified by the `transceiver_id`.


See [RTCStatsReport](https://www.w3.org/TR/webrtc/#rtcstatsreport-object) for the output structure.
This function kills the PeerConnection process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This function kills the PeerConnection process.
This function kills the `ExWebRTC.PeerConnection` process.

Records incoming RTP Packet.
`time` parameter accepts output of `System.monotonic_time()` as a value.
"""
# `time` parameter accepts output of `System.monotonic_time()` as a value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the previous docs could stay

Copy link
Member Author

@LVala LVala May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say to leave as a comment and in general use comments for developer information and docs for public stuff? The only useful thing I could think off was that the LSP would provide the doc info even when function is private, but it doesn't seem to be the case.

EDIT: nvm, LSP does provide this info (which is actually useful), so I'll leave it as a doc.

This function can be called only if at least one packet has been recorded,
otherwise it will raise.
"""
# `time` parameter accepts output of `System.os_time(:native)` as a value (UNIX timestamp in :native units).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 72.09302% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 86.46%. Comparing base (b158659) to head (b5cb05e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
- Coverage   87.20%   86.46%   -0.75%     
==========================================
  Files          33       33              
  Lines        1626     1655      +29     
==========================================
+ Hits         1418     1431      +13     
- Misses        208      224      +16     
Files Coverage Δ
lib/ex_webrtc/rtp_receiver/nack_generator.ex 100.00% <ø> (ø)
lib/ex_webrtc/rtp_receiver/report_recorder.ex 96.66% <ø> (ø)
lib/ex_webrtc/rtp_sender.ex 92.30% <100.00%> (+0.20%) ⬆️
lib/ex_webrtc/rtp_sender/nack_responder.ex 100.00% <ø> (ø)
lib/ex_webrtc/rtp_sender/report_recorder.ex 96.96% <ø> (ø)
lib/ex_webrtc/rtp_receiver.ex 74.19% <60.00%> (ø)
lib/ex_webrtc/rtp_transceiver.ex 90.30% <92.30%> (+0.49%) ⬆️
lib/ex_webrtc/peer_connection.ex 80.43% <62.26%> (-2.10%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b158659...b5cb05e. Read the comment docs.

@LVala LVala merged commit c2d6e5d into master May 9, 2024
3 checks passed
@LVala LVala deleted the improve-api branch May 9, 2024 07:13
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.

None yet

2 participants