Skip to content

Commit

Permalink
Update C API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed Nov 11, 2023
1 parent 4df8400 commit 7f5b391
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@ Arguments:
- `reliability`: a structure of reliability settings containing:
- `unordered`: if `true`, the Data Channel will not enforce message ordering, else it will be ordered
- `unreliable`: if `true`, the Data Channel will not enforce strict reliability, else it will be reliable
- `maxPacketLifeTime`: if unreliable, maximum packet life time in milliseconds
- `maxRetransmits`: if unreliable and maxPacketLifeTime is 0, maximum number of retransmissions (0 means no retransmission)
- `maxPacketLifeTime`: if unreliable, time window in milliseconds during which transmissions and retransmissions may occur
- `maxRetransmits`: if unreliable and maxPacketLifeTime is 0, maximum number of attempted retransmissions (0 means no retransmission)
- `protocol` (optional): a user-defined UTF-8 string representing the Data Channel protocol, empty if NULL
- `negotiated`: if `true`, the Data Channel is assumed to be negotiated by the user and won't be negotiated by the WebRTC layer
- `manualStream`: if `true`, the Data Channel will use `stream` as stream ID, else an available id is automatically selected
Expand Down
4 changes: 2 additions & 2 deletions include/rtc/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ RTC_C_EXPORT int rtcReceiveMessage(int id, char *buffer, int *size);
typedef struct {
bool unordered;
bool unreliable;
int maxPacketLifeTime; // ignored if reliable
int maxRetransmits; // ignored if reliable
unsigned int maxPacketLifeTime; // ignored if reliable
unsigned int maxRetransmits; // ignored if reliable
} rtcReliability;

typedef struct {
Expand Down
4 changes: 2 additions & 2 deletions pages/content/pages/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ Arguments:
- `reliability`: a structure of reliability settings containing:
- `unordered`: if `true`, the Data Channel will not enforce message ordering, else it will be ordered
- `unreliable`: if `true`, the Data Channel will not enforce strict reliability, else it will be reliable
- `maxPacketLifeTime`: if unreliable, maximum packet life time in milliseconds
- `maxRetransmits`: if unreliable and maxPacketLifeTime is 0, maximum number of retransmissions (0 means no retransmission)
- `maxPacketLifeTime`: if unreliable, time window in milliseconds during which transmissions and retransmissions may occur
- `maxRetransmits`: if unreliable and maxPacketLifeTime is 0, maximum number of attempted retransmissions (0 means no retransmission)
- `protocol` (optional): a user-defined UTF-8 string representing the Data Channel protocol, empty if NULL
- `negotiated`: if `true`, the Data Channel is assumed to be negotiated by the user and won't be negotiated by the WebRTC layer
- `manualStream`: if `true`, the Data Channel will use `stream` as stream ID, else an available id is automatically selected
Expand Down
8 changes: 4 additions & 4 deletions src/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,12 +966,12 @@ int rtcGetDataChannelReliability(int dc, rtcReliability *reliability) {
Reliability dcr = dataChannel->reliability();
std::memset(reliability, 0, sizeof(*reliability));
reliability->unordered = dcr.unordered;
if (dcr.type == Reliability::Type::Timed) {
if(dcr.maxPacketLifeTime) {
reliability->unreliable = true;
reliability->maxPacketLifeTime = int(std::get<milliseconds>(dcr.rexmit).count());
} else if (dcr.type == Reliability::Type::Rexmit) {
reliability->maxPacketLifeTime = dcr.maxPacketLifeTime->count();
} else if (dcr.maxRetransmits) {
reliability->unreliable = true;
reliability->maxRetransmits = std::get<int>(dcr.rexmit);
reliability->maxRetransmits = *dcr.maxRetransmits;
} else {
reliability->unreliable = false;
}
Expand Down

0 comments on commit 7f5b391

Please sign in to comment.