Skip to content

feat(esp32-timer-cam): Update timer cam example to be RTSP video streamer#635

Merged
finger563 merged 3 commits into
mainfrom
feat/esp32-timer-cam-example
Jun 9, 2026
Merged

feat(esp32-timer-cam): Update timer cam example to be RTSP video streamer#635
finger563 merged 3 commits into
mainfrom
feat/esp32-timer-cam-example

Conversation

@finger563

@finger563 finger563 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates the ESP32 TimerCam example from a simple board demo into a full
RTSP video streamer built on the espp::RtspServer component.

The updated example:

  • initializes the TimerCam camera and WiFi stack
  • starts an RTSP server when the device gets an IP address
  • captures OV2640 JPEG frames and streams them over RTSP
  • uses the onboard LED breathing helpers to indicate disconnected / connected
    states
  • includes memory monitoring and CLI access for runtime inspection

This PR also includes follow-up robustness fixes for the streamer path:

  • avoid a potential null dereference by taking a local shared_ptr snapshot of
    rtsp_server before sending frames
  • fix JPEG end-of-image validation to safely require a valid 0xFF 0xD9 marker
    and avoid out-of-bounds access on short frames
  • abort startup early if camera initialization fails, instead of continuing in a
    partially initialized state

Motivation and Context

This change makes the ESP32 TimerCam example much more useful as a practical
reference application by turning it into a complete RTSP video streaming demo.

It solves a few problems:

  • the previous example did not demonstrate the TimerCam as a full RTSP video
    endpoint
  • the camera task had a race around rtsp_server lifetime during frame send
  • JPEG validation in the capture path was incorrect and unsafe for short frames
  • camera initialization failures did not stop the app from continuing into an
    unusable streaming state

How has this been tested?

The updated example was tested by building:

  • components/esp32-timer-cam/example

The follow-up safety fixes were also validated by rebuilding the same example
after:

  • fixing the RTSP server lifetime handling
  • correcting JPEG EOI validation
  • gating startup on successful camera initialization

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Copilot AI review requested due to automatic review settings June 8, 2026 17:28
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the esp32-timer-cam example to act as an RTSP MJPEG video streamer, adding WiFi connectivity, RTSP server setup, and runtime monitoring/CLI tooling.

Changes:

  • Reworked the example app to initialize the camera, connect to WiFi, and stream captured JPEG frames over an RTSP server with mDNS.
  • Added project configuration (Kconfig) and partitioning defaults to support streaming use-cases (PSRAM, custom partitions).
  • Updated the example build configuration to include additional dependencies/components for networking and streaming.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
components/esp32-timer-cam/example/sdkconfig.defaults Expands default SDK config (PSRAM, stacks, LWIP/WiFi settings, custom partition table).
components/esp32-timer-cam/example/partitions.csv Adds a custom partition table including a LittleFS partition.
components/esp32-timer-cam/example/main/Kconfig.projbuild Introduces menuconfig options for RTSP port and WiFi credentials.
components/esp32-timer-cam/example/main/idf_component.yml Adds Component Manager dependencies for the example (camera, mdns, espp components).
components/esp32-timer-cam/example/main/esp_timer_cam_example.cpp Implements the RTSP streamer example: camera init, WiFi STA, RTSP server + mDNS, capture loop, and monitoring CLI.
components/esp32-timer-cam/example/CMakeLists.txt Updates the example build/component inclusion configuration for new dependencies.

Comment thread components/esp32-timer-cam/example/main/esp_timer_cam_example.cpp Outdated
Comment thread components/esp32-timer-cam/example/main/esp_timer_cam_example.cpp
Comment thread components/esp32-timer-cam/example/main/esp_timer_cam_example.cpp
Comment thread components/esp32-timer-cam/example/CMakeLists.txt
Comment thread components/esp32-timer-cam/example/sdkconfig.defaults
@finger563 finger563 self-assigned this Jun 8, 2026
@finger563 finger563 merged commit ff0fdf0 into main Jun 9, 2026
111 checks passed
@finger563 finger563 deleted the feat/esp32-timer-cam-example branch June 9, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants