rtsp protocol example interrupt problem.

accacca
Posts: 40
Joined: Mon Aug 06, 2018 4:59 pm

rtsp protocol example interrupt problem.

Postby accacca » Sat Jul 12, 2025 8:42 am

I have compiled the ESP_RTSP example for use with an ESP32-S3 Korvo2 V3.1 board
I am using
VSCODE
ESP-IDF v5.4.
ESP-ADF v2.7.
I want to use the KORVO board as an RTSP server. I want to connect via VLC from the PC.
The example starts correctly, configures the camera and, from the console, I can start the RTP server.

Code: Select all

 
 (2340) camera: Detected OV2640 camera
I (2340) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (2413) cam_hal: buffer_size: 16384, half_buffer_size: 1024, node_buffer_size: 1024, node_cnt: 16, total_cnt: 20
I (2413) cam_hal: Allocating 20480 Byte frame buffer in PSRAM
I (2417) cam_hal: Allocating 20480 Byte frame buffer in PSRAM
I (2423) s3 ll_cam: b+++
I (2425) cam_hal: cam config ok
I (2428) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (2506) ESP_RTSP_Demo: [ 3 ] Initialize console command
n (2506) CONSOLE: Command history enabled

 Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.

Your terminal application does not support escape sequences.

Line editing and history features are disabled.

On Windows, try using Putty instead.
esp32s3> I (3018) main_task: Returned from app_main()

esp32s3> start 0 rtsp://129.168.1.18:554/live
I (31998) ESP_RTSP_SERVER: esp_rtsp ver: 1.1.0 compile date: Sep 27 2024-03:07:26
I (32000) ESP_RTSP_SERVER: RTSP server task started URL: rtsp://192.168.1.18:8554
esp32s3> I (37252) ESP_RTSP_SERVER: RTSP Client ip address: 192.168.1.16
I (37264) ESP_RTSP_SERVER: RX:
However, when I connect to VLC, the rtsp initial configuration is ok but when the client send PLAY method I get nothing from the camera. (the av_video_enc_read receive always a NULL frame)

The "cam_task" task is correctly installed and waiting for a CAM_VSYNC_EVENT.

Code: Select all

static void cam_task(void *arg)
{
    int cnt = 0;
    int frame_pos = 0;
    cam_obj->state = CAM_STATE_IDLE;
    cam_event_t cam_event = 0;

    xQueueReset(cam_obj->event_queue);

    while (1) {
        xQueueReceive(cam_obj->event_queue, (void *)&cam_event, portMAX_DELAY);
The CAM_VSYNC_EVENT is queued by ll_cam_vsync_isr, but the interrupt never seems to be triggered.

Can anyone help me understand how it should be triggered and whether I have made any mistakes in the configuration?

ahsan_islam
Posts: 2
Joined: Mon Jul 21, 2025 1:30 pm

Re: rtsp protocol example interrupt problem.

Postby ahsan_islam » Mon Jul 21, 2025 1:36 pm

Can you locate where the actual RTSP messages are coded? I have found a file esp_media_protocols/include/esp_rtsp.h, but not esp_rtsp.c.

accacca
Posts: 40
Joined: Mon Aug 06, 2018 4:59 pm

Re: rtsp protocol example interrupt problem.

Postby accacca » Tue Jul 22, 2025 6:29 am

Prebuild library
esp-adf\components\esp-adf-libs\esp_media_protocols\lib\

accacca
Posts: 40
Joined: Mon Aug 06, 2018 4:59 pm

Re: rtsp protocol example interrupt problem.

Postby accacca » Tue Jul 22, 2025 4:43 pm

Problem found...
File av_stream_hal_camera.c function av_stream_camera_init

Code: Select all

int av_stream_camera_init(av_stream_hal_config_t *config, void *cb, void *arg)
{
    AUDIO_NULL_CHECK(TAG, config, return ESP_FAIL);

    if (config->uvc_en) {
        if (usb_camera_init(config, cb, arg) != ESP_OK) {
            return ESP_FAIL;
        }
    } else {
        //camera_config.frame_size = config->video_framesize;
        ESP_LOGI (TAG, "framesize %d", config->video_framesize) ;
        if (config->video_soft_enc) {
            camera_config.pixel_format = PIXFORMAT_YUV422;
        }
        if (config->uac_en) {
            camera_config.pin_sccb_scl = CAM_PIN_SIOC;
            camera_config.pin_sccb_sda = CAM_PIN_SIOD;
        }
        if (esp_camera_init(&camera_config) != ESP_OK) {
            return ESP_FAIL;
        }
    }

    return ESP_OK;
}
After removing the line

Code: Select all

 /camera_config.frame_size = config->video_framesize;
the streaming start


but RTSP_FRAME_SIZE is defined AV_FRAMESIZE_HVGA = 7 from av_stream_hal.h

Code: Select all

typedef enum {
    AV_FRAMESIZE_96X96,    // 96x96
    AV_FRAMESIZE_QQVGA,    // 160x120
    AV_FRAMESIZE_QCIF,     // 176x144
    AV_FRAMESIZE_HQVGA,    // 240x176
    AV_FRAMESIZE_240X240,  // 240x240
    AV_FRAMESIZE_QVGA,     // 320x240
    AV_FRAMESIZE_CIF,      // 400x296
    AV_FRAMESIZE_HVGA,     // 480x320
AV_FRAMESIZE_HVGA = 7

But sensor.h have a different enum

Code: Select all

typedef enum {
    FRAMESIZE_96X96,    // 96x96
    FRAMESIZE_QQVGA,    // 160x120
    FRAMESIZE_128X128,    // 128x128
    FRAMESIZE_QCIF,     // 176x144
    FRAMESIZE_HQVGA,    // 240x176
    FRAMESIZE_240X240,  // 240x240
    FRAMESIZE_QVGA,     // 320x240
    FRAMESIZE_320X320,  // 320x320
    FRAMESIZE_CIF,      // 400x296
    FRAMESIZE_HVGA,     // 480x320
FRAMESIZE_HVGA = 9

Who is online

Users browsing this forum: No registered users and 0 guests