Skip to content

Commit 7c670a5

Browse files
committed
Merge branch 'feature/add_peer_default_v1.2' into 'main'
Add peer_default v1.2.0 See merge request adf/esp-webrtc-solution!34
2 parents ccff3bd + c6217d0 commit 7c670a5

File tree

9 files changed

+39
-9
lines changed

9 files changed

+39
-9
lines changed

components/esp_webrtc/impl/peer_default/CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v1.2.0
4+
5+
### Features
6+
7+
- Added reliable and un-ordered data channel support
8+
- Added FORWARD-TSN support for un-ordered data channel
9+
10+
### Bug Fixes
11+
12+
- Fixed keep alive check not take effect if agent only have local candidates
13+
- Fixed agent mode not set if remote candidate already get
14+
315
## v1.1.0
416

517
### Features
@@ -10,7 +22,7 @@
1022

1123
### Bug Fixes
1224

13-
- Fixed keep alive check not take effect if peer closed unexpectly
25+
- Fixed keep alive check not take effect if peer closed unexpectedly
1426

1527

1628
## v1.0.0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

components/esp_webrtc/include/esp_peer.h

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern "C" {
3636
typedef enum {
3737
ESP_PEER_STATE_CLOSED = 0, /*!< Closed */
3838
ESP_PEER_STATE_DISCONNECTED = 1, /*!< Disconnected */
39-
ESP_PEER_STATE_NEW_CONNECTION = 2, /*!< New connection comming */
39+
ESP_PEER_STATE_NEW_CONNECTION = 2, /*!< New connection coming */
4040
ESP_PEER_STATE_PAIRING = 3, /*!< Under candidate pairing */
4141
ESP_PEER_STATE_PAIRED = 4, /*!< Candidate pairing success */
4242
ESP_PEER_STATE_CONNECTING = 5, /*!< Building connection with peer */
@@ -45,7 +45,7 @@ typedef enum {
4545
ESP_PEER_STATE_DATA_CHANNEL_CONNECTED = 8, /*!< Data channel is connected */
4646
ESP_PEER_STATE_DATA_CHANNEL_OPENED = 9, /*!< Data channel is opened */
4747
ESP_PEER_STATE_DATA_CHANNEL_CLOSED = 10, /*!< Data channel is closed */
48-
ESP_PEER_STATE_DATA_CHANNEL_DISCONNECTED = 11, /*!< Data channel is disconencted */
48+
ESP_PEER_STATE_DATA_CHANNEL_DISCONNECTED = 11, /*!< Data channel is disconnected */
4949
} esp_peer_state_t;
5050

5151
/**
@@ -161,10 +161,25 @@ typedef struct {
161161
} esp_peer_msg_t;
162162

163163
/**
164-
* @brief Peer data channel configuration for create
164+
* @brief Reliable type for peer data channel
165+
*/
166+
typedef enum {
167+
ESP_PEER_DATA_CHANNEL_RELIABLE, /*!< Reliable data channel with guaranteed delivery */
168+
ESP_PEER_DATA_CHANNEL_PARTIAL_RELIABLE_TIMEOUT, /*!< Unreliable by lifetime (maxPacketLifeTime) */
169+
ESP_PEER_DATA_CHANNEL_PARTIAL_RELIABLE_RETX, /*!< Unreliable by max retransmits (maxRetransmits) */
170+
} esp_peer_data_channel_reliable_type_t;
171+
172+
/**
173+
* @brief Configuration for peer data channel
165174
*/
166175
typedef struct {
167-
char *label; /*!< Data channel label */
176+
esp_peer_data_channel_reliable_type_t type; /*!< Reliability type */
177+
bool ordered; /*!< true = ordered delivery, false = unordered */
178+
char *label; /*!< Data channel label */
179+
union {
180+
uint16_t max_retransmit_count; /*!< Only valid if type is ESP_PEER_DATA_CHANNEL_PARTIAL_RELIABLE_RETX */
181+
uint16_t max_packet_lifetime; /*!< Only valid if type is ESP_PEER_DATA_CHANNEL_PARTIAL_RELIABLE_TIMEOUT (in milliseconds) */
182+
};
168183
} esp_peer_data_channel_cfg_t;
169184

170185
/**
@@ -196,6 +211,7 @@ typedef struct {
196211
bool enable_data_channel; /*!< Enable data channel */
197212
bool manual_ch_create; /*!< Manual create data channel
198213
When SCTP role is client, it will try to send DCEP automatically
214+
The default configuration are ordered, partial reliable timeout when use peer_default
199215
To disable this behavior can create data channel manually and set this flag
200216
*/
201217
void *extra_cfg; /*!< Extra configuration */
@@ -257,7 +273,7 @@ typedef struct {
257273
* @return Status code indicating success or failure.
258274
*/
259275
int (*on_channel_open)(esp_peer_data_channel_info_t *ch, void *ctx);
260-
276+
261277
/**
262278
* @brief Peer data frame callback
263279
* @param[in] frame Data frame information
@@ -414,7 +430,7 @@ int esp_peer_new_connection(esp_peer_handle_t peer);
414430
* @brief Manually create data channel
415431
*
416432
* @note It will send DCEP event to peer until data channel created
417-
*
433+
*
418434
* @param[in] peer Peer handle
419435
* @param[in] ch_cfg Configuration for data channel creation
420436
*
@@ -505,6 +521,7 @@ int esp_peer_send_audio(esp_peer_handle_t peer, esp_peer_audio_frame_t *info);
505521
* - ESP_PEER_ERR_NONE Open peer connection success
506522
* - ESP_PEER_ERR_INVALID_ARG Invalid argument
507523
* - ESP_PEER_ERR_NOT_SUPPORT Not support
524+
* - ESP_PEER_ERR_WOULD_BLOCK Data channel buffer is full, need sleep some time and retry later
508525
*/
509526
int esp_peer_send_data(esp_peer_handle_t peer, esp_peer_data_frame_t *frame);
510527

components/esp_webrtc/include/esp_peer_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ typedef enum {
4444
ESP_PEER_ERR_FAIL = -6, /*!< General error code */
4545
ESP_PEER_ERR_OVER_LIMITED = -7, /*!< Overlimited */
4646
ESP_PEER_ERR_BAD_DATA = -8, /*!< Bad input data */
47+
ESP_PEER_ERR_WOULD_BLOCK = -9, /*!< Not enough buffer for output packet, need sleep and retry later */
4748
} esp_peer_err_t;
4849

4950
/**

solutions/peer_demo/main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static int start_chat(int argc, char **argv)
1717
{
1818
if (argc > 1) {
1919
static char url[128];
20-
snprintf(url, sizeof(url), "https://webrtc.espressif.cn/join/%s", argv[1]);
20+
snprintf(url, sizeof(url), "https://webrtc.espressif.com/join/%s", argv[1]);
2121
start_webrtc(url);
2222
}
2323
return 0;

solutions/videocall_demo/main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static int join_room(int argc, char **argv)
5555
}
5656
}
5757
const char *room_id = room_args.room_id->sval[0];
58-
snprintf(room_url, sizeof(room_url), "https://webrtc.espressif.cn/join/%s", room_id);
58+
snprintf(room_url, sizeof(room_url), "https://webrtc.espressif.com/join/%s", room_id);
5959
ESP_LOGI(TAG, "Start to join in room %s", room_id);
6060
start_webrtc(room_url);
6161
return 0;

0 commit comments

Comments
 (0)