Skip to content

Commit b61b58a

Browse files
committed
Merge branch 'feature/adf_add_media_protocols_component' into 'master'
feat(esp-adf-libs): Add media protocols component See merge request adf/esp-adf-internal!1453
2 parents 894a483 + e3dd18d commit b61b58a

File tree

15 files changed

+122
-19
lines changed

15 files changed

+122
-19
lines changed

components/esp-adf-libs

Submodule esp-adf-libs updated 32 files

examples/advanced_examples/dlna/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ This example demonstrates the process of running a UPnP/DLNA media renderer in t
1010

1111
The Digital Living Network Alliance (DLNA) aims to establish the interoperability among PCs, consumer appliances, and mobile devices in wireless networks and wired networks. The purpose is to provide a solution for sharing between digital media and content services.
1212

13+
### Resources
14+
15+
Memory consumption of the entire example:
16+
17+
| Memory_total (Bytes) | Memory_inram (Bytes) | Memory_psram (Bytes) |
18+
|----------------------|----------------------|----------------------|
19+
| 271836 | 109628 | 162208 |
20+
21+
Test is conducted using the ESP32-S3-Korvo-2 board.
1322

1423
## Environment Setup
1524

examples/advanced_examples/dlna/README_CN.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010

1111
数字生活网络联盟 (Digital Living Network Alliance, DLNA) 旨在解决个人 PC、消费电器和移动设备在内的无线网络和有线网络的互联互通,目的是打通数字媒体和内容服务之间共享的一种解决的方案。
1212

13+
### 资源列表
14+
15+
示例内存消耗:
16+
17+
| Memory_total (Bytes) | Memory_inram (Bytes) | Memory_psram (Bytes) |
18+
|----------------------|----------------------|----------------------|
19+
| 271836 | 109628 | 162208 |
20+
21+
测试使用 ESP32-S3-Korvo-2 开发板。
1322

1423
## 环境配置
1524

examples/advanced_examples/dlna/main/dlna_example.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ void app_main()
327327
esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG();
328328
esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg);
329329
periph_wifi_cfg_t wifi_cfg = {
330-
.wifi_config.sta.ssid = "YOUR_SSID",
331-
.wifi_config.sta.password = "YOUR_PASSWORD",
330+
.wifi_config.sta.ssid = CONFIG_WIFI_SSID,
331+
.wifi_config.sta.password = CONFIG_WIFI_PASSWORD,
332332
};
333333
esp_periph_handle_t wifi_handle = periph_wifi_init(&wifi_cfg);
334334
esp_periph_start(set, wifi_handle);

examples/advanced_examples/multi-room/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ ESP Multi-Room Music is a Wi-Fi-based communication protocol to share music amon
99

1010
### Resources
1111

12-
Memory consumption:
12+
Memory consumption of the entire example:
1313

14-
| memory_total (byte) | memory_inram (byte) | memory_psram (byte) |
15-
|---------------------|---------------------|---------------------|
16-
| 279632 | 145064 | 134568 |
14+
| Memory_total (Bytes) | Memory_inram (Bytes) | Memory_psram (Bytes) |
15+
|----------------------|----------------------|----------------------|
16+
| 279632 | 145064 | 134568 |
17+
18+
Test is conducted using the ESP32-S3-Korvo-2 board.
1719

1820
## Environment Setup
1921

examples/advanced_examples/multi-room/README_CN.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ ESP Multi-Room Music 是一种基于 Wi-Fi 的多扬声器互联共享音乐通
99

1010
### 资源列表
1111

12-
内存消耗
12+
示例内存消耗:
1313

14-
| memory_total (byte) | memory_inram (byte) | memory_psram (byte) |
15-
|---------------------|---------------------|---------------------|
16-
| 279632 | 145064 | 134568 |
14+
| Memory_total (Bytes) | Memory_inram (Bytes) | Memory_psram (Bytes) |
15+
|----------------------|----------------------|----------------------|
16+
| 279632 | 145064 | 134568 |
17+
18+
测试使用 ESP32-S3-Korvo-2 开发板。
1719

1820
## 环境配置
1921

examples/protocols/esp-rtc/README_CN.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88
ESP RTC 是一个基于标准 SIP 协议的视频通话客户端,可以用于音视频通话等场景。
99

10+
### 资源列表
11+
12+
示例内存消耗:
13+
14+
|Memory_total (Bytes)|Memory_inram (Bytes)|Memory_psram (Bytes)
15+
|---|---|---
16+
|263752 |100144 |163608
17+
1018
## 环境配置
1119

1220
### 硬件要求
@@ -32,6 +40,13 @@ ESP RTC 是一个基于标准 SIP 协议的视频通话客户端,可以用于
3240

3341
- 建议在 `conf/vars.xml` 中打开 PCMA、PCMU、VP8、H264。
3442

43+
- 建议关闭服务器自动应答,可以通过在 `conf/dialplan/default.xml` 中设置 `<action application="export" data="sip_auto_answer=false"/>` 来关闭。
44+
45+
- 建议关闭服务器强制应答,可以通过在 `conf/dialplan/default.xml` 中注释以下三行来关闭。
46+
`<action application="answer"/>`
47+
`<action application="sleep" data="1000"/>`
48+
`<action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/>`
49+
3550
- 我们建议搭建 Freeswitch 服务器来测试。
3651

3752
## 编译和下载

examples/protocols/esp-rtc/main/rtc_service.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ static int _esp_rtc_event_handler(esp_rtc_event_t event, void *ctx)
7777
av_video_enc_stop(av_stream);
7878
av_video_dec_stop(av_stream);
7979
break;
80+
case ESP_RTC_EVENT_CALL_ANSWERED:
81+
ESP_LOGI(TAG, "ESP_RTC_EVENT_CALL_ANSWERED");
82+
break;
8083
case ESP_RTC_EVENT_HANGUP:
8184
ESP_LOGI(TAG, "ESP_RTC_EVENT_HANGUP");
8285
break;

examples/protocols/esp-rtsp/README_CN.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ ESP RTSP 是一个基于标准 RSTP 协议的客户端和服务器。
1616
3. 支持作为 RTSP Player,将服务器的 RTSP 流拉下来进行播放。
1717
- 串口输入: ``` start 2 rtsp://192.168.1.1:554/live ```
1818

19+
### 资源列表
20+
21+
示例内存消耗:
22+
23+
|Memory_total (Bytes)|Memory_inram (Bytes)|Memory_psram (Bytes)
24+
|---|---|---
25+
|241364 |97744 |143620
26+
27+
测试使用 ESP32-S3-Korvo-2 开发板,示例模式选择为 Server。
28+
1929
## 环境配置
2030

2131
### 硬件要求

examples/protocols/esp-rtsp/main/rtsp_service.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@
3232
static const char *TAG = "RTSP_SERVICE";
3333

3434
static esp_rtsp_mode_t rtsp_mode;
35+
static uint32_t stream_first_pts;
36+
37+
static uint32_t get_cur_pts()
38+
{
39+
uint32_t cur_pts = 0;
40+
if (stream_first_pts == 0) {
41+
stream_first_pts = esp_timer_get_time() / 1000;
42+
cur_pts = 0;
43+
} else {
44+
cur_pts = esp_timer_get_time() / 1000 - stream_first_pts;
45+
}
46+
return cur_pts;
47+
}
3548

3649
static char *_get_network_ip()
3750
{
@@ -49,6 +62,7 @@ static int _esp_rtsp_state_handler(esp_rtsp_state_t state, void *ctx)
4962
ESP_LOGI(TAG, "RTSP_STATE_SETUP");
5063
break;
5164
case RTSP_STATE_PLAY:
65+
stream_first_pts = 0;
5266
if (rtsp_mode == RTSP_CLIENT_PLAY) {
5367
av_audio_dec_start(av_stream);
5468
} else {
@@ -58,6 +72,7 @@ static int _esp_rtsp_state_handler(esp_rtsp_state_t state, void *ctx)
5872
ESP_LOGI(TAG, "RTSP_STATE_PLAY");
5973
break;
6074
case RTSP_STATE_TEARDOWN:
75+
stream_first_pts = 0;
6176
if (rtsp_mode == RTSP_CLIENT_PLAY) {
6277
av_audio_dec_stop(av_stream);
6378
} else {
@@ -70,7 +85,7 @@ static int _esp_rtsp_state_handler(esp_rtsp_state_t state, void *ctx)
7085
return 0;
7186
}
7287

73-
static int _send_audio(unsigned char *data, int len, void *ctx)
88+
static int _send_audio(unsigned char *data, int len, uint32_t *pts, void *ctx)
7489
{
7590
av_stream_handle_t av_stream = (av_stream_handle_t) ctx;
7691
av_stream_frame_t frame = {0};
@@ -79,6 +94,8 @@ static int _send_audio(unsigned char *data, int len, void *ctx)
7994
if (av_audio_enc_read(&frame, av_stream) < 0) {
8095
return 0;
8196
}
97+
/* av_stream pts out of sync, use system pts instead */
98+
*pts = get_cur_pts();
8299
return frame.len;
83100
}
84101

@@ -91,7 +108,7 @@ static int _receive_audio(unsigned char *data, int len, void *ctx)
91108
return av_audio_dec_write(&frame, av_stream);
92109
}
93110

94-
static int _send_video(unsigned char *data, unsigned int *len, void *ctx)
111+
static int _send_video(unsigned char *data, unsigned int *len, uint32_t *pts, void *ctx)
95112
{
96113
av_stream_handle_t av_stream = (av_stream_handle_t) ctx;
97114
av_stream_frame_t frame = {0};
@@ -101,6 +118,8 @@ static int _send_video(unsigned char *data, unsigned int *len, void *ctx)
101118
return ESP_FAIL;
102119
}
103120
*len = frame.len;
121+
/* av_stream pts out of sync, use system pts instead */
122+
*pts = get_cur_pts();
104123
return ESP_OK;
105124
}
106125

0 commit comments

Comments
 (0)