Skip to content

Commit d2be487

Browse files
Update doc
1 parent bab9544 commit d2be487

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

DOC.md

+22-3
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ Initiates the handshake process. Following this call, the local description call
207207
Arguments:
208208

209209
- `pc`: the Peer Connection identifier
210-
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for autodetection.
210+
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for automatic (recommended).
211+
212+
Warning: This function expects the optional type for the local description and not an SDP description. It is not possible to set an existing SDP description.
211213

212214
#### rtcSetRemoteDescription
213215

@@ -220,7 +222,8 @@ Sets the remote description received from the remote peer by the user's method o
220222
Arguments:
221223

222224
- `pc`: the Peer Connection identifier
223-
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for autodetection.
225+
- `sdp`: the remote description in SDP format
226+
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for automatic (not recommended).
224227

225228
If the remote description is an offer and `disableAutoNegotiation` was not set in `rtcConfiguration`, the library will automatically answer by calling `rtcSetLocalDescription` internally. Otherwise, the user must call it to answer the remote description.
226229

@@ -296,7 +299,7 @@ Return value: the length of the string copied in buffer (including the terminati
296299

297300
If `buffer` is `NULL`, the description is not copied but the size is still returned.
298301

299-
#### rtcGetRemoteDescription
302+
#### rtcGetRemoteDescriptionType
300303

301304
```
302305
int rtcGetRemoteDescriptionType(int pc, char *buffer, int size)
@@ -314,6 +317,22 @@ Return value: the length of the string copied in buffer (including the terminati
314317

315318
If `buffer` is `NULL`, the description is not copied but the size is still returned.
316319

320+
#### rtcCreateOffer/rtcCreateAnswer
321+
322+
```
323+
int rtcCreateOffer(int pc, char *buffer, int size)
324+
int rtcCreateAnswer(int pc, char *buffer, int size)
325+
```
326+
327+
Create a local offer or answer description in SDP format. These functions are intended only for specific use cases where the application needs to generate a description without setting it. It is useless to call them before `rtcSetLocalDescription` as it doesn't expect the user to supply a description.
328+
329+
- `pc`: the Peer Connection identifier
330+
- `buffer`: a user-supplied buffer to store the description
331+
- `size`: the size of `buffer`
332+
333+
Return value: the length of the string copied in buffer (including the terminating null character) or a negative error code
334+
335+
If `buffer` is `NULL`, the description is not copied but the size is still returned.
317336

318337
#### rtcGetLocalAddress
319338

pages/content/pages/reference.md

+22-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ Initiates the handshake process. Following this call, the local description call
210210
Arguments:
211211

212212
- `pc`: the Peer Connection identifier
213-
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for autodetection.
213+
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for automatic (recommended).
214+
215+
Warning: This function expects the optional type for the local description and not an SDP description. It is not possible to set an existing SDP description.
214216

215217
#### rtcSetRemoteDescription
216218

@@ -223,7 +225,8 @@ Sets the remote description received from the remote peer by the user's method o
223225
Arguments:
224226

225227
- `pc`: the Peer Connection identifier
226-
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for autodetection.
228+
- `sdp`: the remote description in SDP format
229+
- `type` (optional): type of the description ("offer", "answer", "pranswer", or "rollback") or NULL for automatic (not recommended).
227230

228231
If the remote description is an offer and `disableAutoNegotiation` was not set in `rtcConfiguration`, the library will automatically answer by calling `rtcSetLocalDescription` internally. Otherwise, the user must call it to answer the remote description.
229232

@@ -299,7 +302,7 @@ Return value: the length of the string copied in buffer (including the terminati
299302

300303
If `buffer` is `NULL`, the description is not copied but the size is still returned.
301304

302-
#### rtcGetRemoteDescription
305+
#### rtcGetRemoteDescriptionType
303306

304307
```
305308
int rtcGetRemoteDescriptionType(int pc, char *buffer, int size)
@@ -317,6 +320,22 @@ Return value: the length of the string copied in buffer (including the terminati
317320

318321
If `buffer` is `NULL`, the description is not copied but the size is still returned.
319322

323+
#### rtcCreateOffer/rtcCreateAnswer
324+
325+
```
326+
int rtcCreateOffer(int pc, char *buffer, int size)
327+
int rtcCreateAnswer(int pc, char *buffer, int size)
328+
```
329+
330+
Create a local offer or answer description in SDP format. These functions are intended only for specific use cases where the application needs to generate a description without setting it. It is useless to call them before `rtcSetLocalDescription` as it doesn't expect the user to supply a description.
331+
332+
- `pc`: the Peer Connection identifier
333+
- `buffer`: a user-supplied buffer to store the description
334+
- `size`: the size of `buffer`
335+
336+
Return value: the length of the string copied in buffer (including the terminating null character) or a negative error code
337+
338+
If `buffer` is `NULL`, the description is not copied but the size is still returned.
320339

321340
#### rtcGetLocalAddress
322341

0 commit comments

Comments
 (0)