feat: Update RTSP so use new component API and have faster / more reliable streaming#15
feat: Update RTSP so use new component API and have faster / more reliable streaming#15finger563 wants to merge 3 commits into
Conversation
…eaming by handling stream failures with backoff and setting static wifi buffers
|
⚡ Static analysis result ⚡ 🔴 cppcheck found 2 issues! Click here to see details.Lines 1 to 5 in 2492ede !Line: 0 - information: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. [normalCheckLevelMaxBranches]
Lines 362 to 367 in 2492ede !Line: 362 - style: Local variable 'lock' shadows outer variable [shadowVariable]
!Line: 352 - note: Shadowed declaration
!Line: 362 - note: Shadow variable |
There was a problem hiding this comment.
Pull request overview
This PR updates the ESP-IDF camera-streamer example to use the newer managed esp32-camera component and adjusts the RTSP streaming loop and system configuration to improve throughput and resiliency.
Changes:
- Migrates the camera dependency from a git submodule to a managed ESP-IDF component and updates the dependency lockfile.
- Updates RTSP streaming behavior (session-aware capture pacing, backoff, and WiFi power-save disable) and adds heap/task monitoring hooks.
- Tweaks default sdkconfig and partitions (PSRAM/WiFi/LWIP tuning; LittleFS partition subtype).
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
sdkconfig.defaults |
Adds PSRAM/WiFi/LWIP tuning defaults and adjusts camera/I2C-related settings. |
partitions.csv |
Switches the littlefs partition subtype from spiffs to littlefs. |
main/main.cpp |
Updates RTSP server startup flow, capture pacing/backoff logic, and adds memory/task monitoring output. |
main/idf_component.yml |
Moves to managed espressif/esp32-camera component dependency. |
dependencies.lock |
Updates component versions/hashes and adds esp32-camera/esp_jpeg to the lock. |
.gitmodules |
Removes the components/esp32-camera submodule entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| std::lock_guard<std::recursive_mutex> lock(server_mutex); | ||
| if (!rtsp_server || !rtsp_server->has_active_sessions()) { | ||
| wait_until(start + idle_capture_poll_period); | ||
| return false; | ||
| } | ||
| auto recommended_capture_period = rtsp_server->get_recommended_capture_period(); | ||
| auto capture_cooldown = rtsp_server->get_capture_cooldown(); | ||
| if (capture_cooldown > 0ms) { | ||
| wait_until(start + std::max(recommended_capture_period, capture_cooldown)); | ||
| return false; | ||
| } | ||
| } |
| std::span<const uint8_t> jpg_buf(_jpg_buf, _jpg_buf_len); | ||
| espp::JpegFrame image(jpg_buf); | ||
| std::lock_guard<std::recursive_mutex> lock(server_mutex); | ||
| rtsp_server->send_frame(image); | ||
| rtsp_server->send_frame(jpg_buf); | ||
| frames_streamed++; | ||
|
|
| if (!(_jpg_buf[_jpg_buf_len - 1] != 0xd9 || _jpg_buf[_jpg_buf_len - 2] != 0xd9)) { | ||
| esp_camera_fb_return(fb); | ||
| return false; | ||
| } |
| # | ||
| # ESP32S3-specific | ||
| # |
ESP-IDF Size Report for 'Camera Streamer'
FLASH uses app .bin size or json2 flash sum. RAM sums DRAM+IRAM via idf_size. Percentages shown when totals are available. |
Description
Motivation and Context
How has this been tested?
Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
Checklist:
Software
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action.Hardware