jeanlemotan / esp32-cam-fpv

esp32 cam digital low latency fpv
MIT License
292 stars 75 forks source link

make esp32-cam as submodule #34

Open Ncerzzk opened 1 year ago

Ncerzzk commented 1 year ago

Hi, this pr aims to make esp32-cam as git submodule.

advantages:

  1. we can track the hacks we do in esp32-camera, so that we will be easy to upgrade the component in the future.(I would try to open pr in esp32-camera, to add the data_avaiable_callback into main stream)
  2. this hacked submodule (now point to https://github.com/Ncerzzk/esp32-camera/tree/for-esp-cam-fpv) was editd from latest esp32-camera code, so we can compile it in IDF4.3 4.4 or 5.0, then we can move to next step to upgrade the framework of esp32-cam-fpv to support idf5.0

Thank you. Feel free to comment

dizcza commented 1 year ago

Would love to see this PR merged.

Also, I'm having trouble with jeanlemotan's master branch:

I (817) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (906) wifi:mode : sta (44:17:93:7e:34:dc)
I (907) wifi:enable tsf
I (908) wifi:Set ps type: 0

I (909) wifi:ic_enable_sniffer
MEMORY After WIFI: 
Heap summary for capabilities 0x00000004:
  At 0x3ffae6e0 len 6432 free 4 allocated 5912 min_free 4
    largest_free_block 0 alloc_blocks 34 free_blocks 0 total_blocks 34
  At 0x3ffb7b50 len 165040 free 4 allocated 162720 min_free 4
    largest_free_block 0 alloc_blocks 344 free_blocks 0 total_blocks 344
  At 0x3ffe0440 len 15072 free 32 allocated 14528 min_free 4
    largest_free_block 24 alloc_blocks 24 free_blocks 1 total_blocks 25
  At 0x3ffe4350 len 113840 free 61000 allocated 51768 min_free 61000
    largest_free_block 59392 alloc_blocks 50 free_blocks 1 total_blocks 51
  Totals:
    free 61040 allocated 234928 min_free 61012 largest_free_block 59392
Initialized
I (969) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (978) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (987) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (997) gpio: GPIO[21]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1006) gpio: GPIO[22]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1015) gpio: GPIO[23]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1025) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1034) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1043) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1053) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1062) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (1072) sccb: pin_sda 26 pin_scl 27

I (1077) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1225) camera: Detected OV2640 camera
I (1226) camera: Line width (for DMA): 6400 bytes
I (1226) camera: DMA buffer size: 3200, DMA buffers per line: 2
I (1231) camera: DMA buffer count: 8
I (1235) camera: DMA buffer total: 25600 bytes
I (1240) camera: Allocating DMA buffer #0, size=3200
I (1246) camera: Allocating DMA buffer #1, size=3200
I (1251) camera: Allocating DMA buffer #2, size=3200
I (1257) camera: Allocating DMA buffer #3, size=3200
I (1262) camera: Allocating DMA buffer #4, size=3200
I (1268) camera: Allocating DMA buffer #5, size=3200
I (1274) camera: Allocating DMA buffer #6, size=3200
I (1279) camera: Allocating DMA buffer #7, size=3200
E (2349) camera: Timeout waiting for VSYNC
E (2350) camera: Camera init failed with error 0x20003
Camera init failed with error 0x20003MEMORY Before Loop: 
Heap summary for capabilities 0x00000004:
  At 0x3ffae6e0 len 6432 free 4 allocated 5912 min_free 4
    largest_free_block 0 alloc_blocks 34 free_blocks 0 total_blocks 34
  At 0x3ffb7b50 len 165040 free 4 allocated 162720 min_free 4
    largest_free_block 0 alloc_blocks 344 free_blocks 0 total_blocks 344
  At 0x3ffe0440 len 15072 free 4 allocated 14552 min_free 4
    largest_free_block 0 alloc_blocks 25 free_blocks 0 total_blocks 25
  At 0x3ffe4350 len 113840 free 40960 allocated 71736 min_free 29268
    largest_free_block 29696 alloc_blocks 68 free_blocks 3 total_blocks 71
  Totals:
    free 40972 allocated 254920 min_free 29280 largest_free_block 29696
WLAN S: 0, R: 0, E: 0, D: 0, % : 0 || FPS: 0, D: 0 || D: 0, E: 0
WLAN S: 0, R: 0, E: 0, D: 0, % : 0 || FPS: 0, D: 0 || D: 0, E: 0

while the PR author's orangepi branch works out of the box for my ESP32-CAM.

dizcza commented 1 year ago

And also, how to use your project without WiFi? I was looking for a solution for fast video recording to an SD card, that's how I came upon this project and the fork. The video won't be streamed. I tried to remove WiFi dependencies but there are toooo many here. Would be nice to have a single flag to turn it on and off. Besides jamming my magnetic sensors with RF signals, wifi usage cuts down the available RAM significantly, not to mention the flash size.

Ncerzzk commented 1 year ago

Hi, the root cause is that there are no enough ram to allocate DMA buffer. In my changes, I have force to set it to:

        cam->dma_half_buffer_cnt = 4;
        cam->dma_node_buffer_size = cam->width * cam->dma_bytes_per_item > 2048 ? 2048 :cam->width * cam->dma_bytes_per_item;
        cam->dma_half_buffer_size = cam->dma_node_buffer_size * 2;

and origin project is:

    size_t line_size = s_state->width * s_state->in_bytes_per_pixel *
                       i2s_bytes_per_sample(s_state->sampling_mode);
    ESP_LOGI(TAG, "Line width (for DMA): %d bytes", line_size);
    size_t dma_per_line = 1;
    size_t buf_size = line_size;
    while (buf_size >= 4096) {
        buf_size /= 2;
        dma_per_line *= 2;
    }
    size_t dma_desc_count = dma_per_line * 4;
    s_state->dma_buf_width = line_size;
    s_state->dma_per_line = dma_per_line;
    s_state->dma_desc_count = dma_desc_count;

also, if you want to use sd recording, you can simply set s_ground2air_config_packet. dvr_record = true

dizcza commented 1 year ago

@Ncerzzk thanks for pinpoiting the relevant changes. I'll try to checkout these changes and see if I manage to run jeanlemotan's code with them.

also, if you want to use sd recording, you can simply set s_ground2air_config_packet. dvr_record = true

I know. But as I said, WiFi jams my magnetic sensor measurements if put in close proximity: the magnetic field measurement noise increase up to 2-3X times if WiFi is on! Even broadcasting ping packets... So I'd like to turn it off completely. This will also save the juice to spend CPU & DRAM resources on other tasks.

Ncerzzk commented 1 year ago

got it. in my orangepi3lts branch, I have do some cleanning up and move large part of wifi relation to wifi.c and wifi.h, but I have not tried to close wifi yet.

---Original--- From: "Danylo @.> Date: Sun, Mar 5, 2023 14:21 PM To: @.>; Cc: @.**@.>; Subject: Re: [jeanlemotan/esp32-cam-fpv] make esp32-cam as submodule (PR #34)

@Ncerzzk thanks for pinpoiting the relevant changes. I'll try to checkout these changes and see if I manage to run jeanlemotan's code with them.

also, if you want to use sd recording, you can simply set s_ground2air_config_packet. dvr_record = true

I know. But as I said, WiFi jams my magnetic sensor measurements if put in close proximity: the magnetic field measurement noise increase up to 2-3X times if WiFi is on! Even broadcasting ping packets... So I'd like to turn it off completely. This will also save the juice to spend CPU & DRAM resources on other tasks.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jeanlemotan commented 1 year ago

Thanks a lot for this PR. I will try this weekend to test it on my setup and merge it afterwards. Sorry for the delays, I have very little time during the week to handle this.

jeanlemotan commented 1 year ago

Regarding disabling the wifi, this should be relatively easy to configure. I can add some defines to completely disable all the wifi functionality.

dizcza commented 1 year ago

Regarding disabling the wifi, this should be relatively easy to configure. I can add some defines to completely disable all the wifi functionality.

That would be great, thanks.

dizcza commented 1 year ago

But firstly I'd like to see Ncerzzk's changes he mentioned

        cam->dma_half_buffer_cnt = 4;
        cam->dma_node_buffer_size = cam->width * cam->dma_bytes_per_item > 2048 ? 2048 :cam->width * cam->dma_bytes_per_item;
        cam->dma_half_buffer_size = cam->dma_node_buffer_size * 2;

here. It's not straightforward and the diff is shown only partially.

Ncerzzk commented 1 year ago

Hi, these changes are done in https://github.com/Ncerzzk/esp32-camera/tree/for-esp-cam-fpv because esp32-camera version is a bit different from main branch now use, it cannot directly be used in main branch. while you can set buf_size=2048, dma_desc_count=4, to reduce the dma buffer size in main branch.

dizcza commented 1 year ago

Ah I see, so the changes come from Espressif's fork, not this repo.

Got it.

dizcza commented 1 year ago

@Ncerzzk so I ran your code in https://github.com/Ncerzzk/esp32-camera/tree/for-esp-cam-fpv (take_picture example) and got

I (27) boot: ESP-IDF v5.0-159-g75c3a69feb-dirty 2nd stage bootloader
I (27) boot: compile time 10:06:38
I (27) boot: chip revision: v3.0
I (32) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (39) qio_mode: Enabling default flash chip QIO
I (44) boot.esp32: SPI Speed      : 80MHz
I (49) boot.esp32: SPI Mode       : QIO
I (53) boot.esp32: SPI Flash Size : 4MB
I (58) boot: Enabling RNG early entropy source...
I (63) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (74) boot:  0 nvs              WiFi data        01 02 00011000 00006000
I (82) boot:  1 phy_init         RF data          01 01 00017000 00001000
I (89) boot:  2 factory          factory app      00 00 00020000 00100000
I (97) boot: End of partition table
I (101) boot_comm: chip revision: 3, min. application chip revision: 0
I (108) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=10b9ch ( 68508) map
I (136) esp_image: segment 1: paddr=00030bc4 vaddr=3ffb0000 size=03c78h ( 15480) load
I (141) esp_image: segment 2: paddr=00034844 vaddr=40080000 size=0b7d4h ( 47060) load
I (157) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=29a10h (170512) map
I (204) esp_image: segment 4: paddr=00069a38 vaddr=4008b7d4 size=07104h ( 28932) load
I (223) boot: Loaded app from partition at offset 0x20000
I (223) boot: Disabling RNG early entropy source...
I (235) quad_psram: This chip is ESP32-D0WD
I (235) esp_psram: Found 2MB PSRAM device
I (236) esp_psram: Speed: 80MHz
I (237) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
I (244) cpu_start: Pro cpu up.
I (248) cpu_start: Starting app cpu, entry point is 0x400814b0
0x400814b0: call_start_cpu1 at /home/dizcza/tools/esp-idf/components/esp_system/port/cpu_start.c:142

I (241) cpu_start: App cpu up.
I (521) esp_psram: SPI SRAM memory test OK
I (529) cpu_start: Pro cpu start user code
I (529) cpu_start: cpu freq: 240000000 Hz
I (529) cpu_start: Application information:
I (532) cpu_start: Project name:     camera_example
I (537) cpu_start: App version:      1
I (542) cpu_start: Compile time:     Mar  8 2023 10:23:19
I (548) cpu_start: ELF file SHA256:  c42b1ee866f94101...
I (554) cpu_start: ESP-IDF:          v5.0-159-g75c3a69feb-dirty
I (561) heap_init: Initializing. RAM available for dynamic allocation:
I (568) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (574) heap_init: At 3FFB46F8 len 0002B908 (174 KiB): DRAM
I (580) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (586) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (593) heap_init: At 400928D8 len 0000D728 (53 KiB): IRAM
I (599) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator
I (607) spi_flash: detected chip: generic
I (611) spi_flash: flash io: qio
I (616) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (631) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (640) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 
I (649) cam_hal: cam init ok
I (652) sccb: pin_sda 26 pin_scl 27
I (656) sccb: sccb_i2c_port=1

I (661) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (700) camera: Detected camera at address=0x30
I (703) camera: Detected OV2640 camera
I (703) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (785) esp32 ll_cam: node_size: 2560, nodes_per_line: 1, lines_per_node: 1, dma_half_buffer_min:  2560, dma_half_buffer: 15360,lines_per_half_buffer:  6, dma_buffer_size: 30720, image_size: 153600
I (792) cam_hal: buffer_size: 30720, half_buffer_size: 15360, node_buffer_size: 2560, node_cnt: 12, total_cnt: 10
I (803) cam_hal: Allocating 16 Byte frame buffer in PSRAM
I (809) cam_hal: cam config ok
I (884) example:take_picture: Taking picture...
Guru Meditation Error: Core  0 panic'ed (InstrFetchProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x00000000  PS      : 0x00060e30  A0      : 0x8008e33c  A1      : 0x3ffc8810  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000  
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x800db26a  A9      : 0x00007800  
A10     : 0x3ffb8bf8  A11     : 0x3ffc0800  A12     : 0x00003c00  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x3f80086c  SAR     : 0x0000000c  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x40088634  LEND    : 0x40088650  LCOUNT  : 0xffffffff  
0x40088634: memcpy at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memcpy.S:175

0x40088650: memcpy at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memcpy.S:197

Backtrace: 0xfffffffd:0x3ffc8810 0x4008e339:0x3ffc8850
0x4008e339: vPortTaskWrapper at /home/dizcza/tools/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:151

although as I said the camera is detected in orangepi branch of this project.

Ncerzzk commented 1 year ago

@dizcza the for-esp-cam-fpv branch is only target for wifi sending. the main hack is: https://github.com/Ncerzzk/esp32-camera/commit/97173171f663d4363fe306c6e2689d91c2c9e7d1

this hack add a data_available_callback, and the data from camera will not be saved to frame buffer, so the example could not run. you should handle data by yourself in data_available_callback.

dizcza commented 1 year ago

All right, I did that:

#include <esp_log.h>
#include <esp_system.h>
#include <sys/param.h>
#include <string.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_timer.h"
#include "esp_camera.h"
#include "bsp.h"
#include "sdcard.h"
#include "sdcard_record.h"

// support IDF 5.x
#ifndef portTICK_RATE_MS
#define portTICK_RATE_MS portTICK_PERIOD_MS
#endif

/* ESP32-CAM AITHINKER START */
#define CAM_PIN_PWDN 32
#define CAM_PIN_RESET -1 //software reset will be performed
#define CAM_PIN_XCLK 0
#define CAM_PIN_SIOD 26
#define CAM_PIN_SIOC 27

#define CAM_PIN_D7 35
#define CAM_PIN_D6 34
#define CAM_PIN_D5 39
#define CAM_PIN_D4 36
#define CAM_PIN_D3 21
#define CAM_PIN_D2 19
#define CAM_PIN_D1 18
#define CAM_PIN_D0 5
#define CAM_PIN_VSYNC 25
#define CAM_PIN_HREF 23
#define CAM_PIN_PCLK 22

static const char *TAG = "main";

size_t my_data_available_callback(void * cam_obj,const uint8_t* data, size_t count, bool last) {
    static FILE *f = NULL;
    static char fname[64];
    static uint32_t frame_id = 0;
    static uint8_t framebuffer_static[30 * 1024];

    const int64_t millis = esp_timer_get_time() / 1000;

    if (f == NULL) {
        snprintf(fname, sizeof(fname), "IMG-%06lu-%lld.JPEG", frame_id++, millis);
        f = sdcard_record_open_file_once_silent(fname, "w");
    }

    memcpy(framebuffer_static, data, count);
    fwrite(framebuffer_static, sizeof(uint8_t), count, f);

    if (frame_id % 10 == 0) {
        float fps = 1000.0 * frame_id / millis;
        ESP_LOGI(TAG, "FPS %.1f", fps);
    }

    if (last) {
        fclose(f);
        f = NULL;
        ESP_LOGI(TAG, "cb %zu bytes last", count);
    }

    return count;
}

static const camera_config_t camera_config = {
    .pin_pwdn = CAM_PIN_PWDN,
    .pin_reset = CAM_PIN_RESET,
    .pin_xclk = CAM_PIN_XCLK,
    .pin_sccb_sda = CAM_PIN_SIOD,
    .pin_sccb_scl = CAM_PIN_SIOC,

    .pin_d7 = CAM_PIN_D7,
    .pin_d6 = CAM_PIN_D6,
    .pin_d5 = CAM_PIN_D5,
    .pin_d4 = CAM_PIN_D4,
    .pin_d3 = CAM_PIN_D3,
    .pin_d2 = CAM_PIN_D2,
    .pin_d1 = CAM_PIN_D1,
    .pin_d0 = CAM_PIN_D0,
    .pin_vsync = CAM_PIN_VSYNC,
    .pin_href = CAM_PIN_HREF,
    .pin_pclk = CAM_PIN_PCLK,

    //XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
    .xclk_freq_hz = 20000000,
    .ledc_timer = LEDC_TIMER_0,
    .ledc_channel = LEDC_CHANNEL_0,

    .pixel_format = PIXFORMAT_JPEG, //YUV422,GRAYSCALE,RGB565,JPEG
    .frame_size = FRAMESIZE_VGA,    //QQVGA-UXGA, For ESP32, do not use sizes above QVGA when not JPEG. The performance of the ESP32-S series has improved a lot, but JPEG mode always gives better frame rates.

    .jpeg_quality = 12, //0-63, for OV series camera sensors, lower number means higher quality
    .fb_count = 5,       //When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode.
    .grab_mode = CAMERA_GRAB_WHEN_EMPTY,
    .data_available_callback = my_data_available_callback
};

static esp_err_t init_camera()
{
    //initialize the camera
    BSP_SOFTCHECK(esp_camera_init(&camera_config));
    return ESP_OK;
}

void app_main()
{
    sdcard_mount_mmc();
    sdcard_record_create_dir("esp32cam");
    sdcard_log_start();

    if (ESP_OK != init_camera()) {
        return;
    }
}

Logs:

I (1053) bsp: App version:   02137e0-dirty
I (1063) bsp: Compile time:  Mar  8 2023 10:57:23
I (1073) bsp: ESP-IDF:       v5.0-159-g75c3a69feb-dirty
I (1083) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 
I (1093) cam_hal: cam init ok
I (1103) sccb: pin_sda 26 pin_scl 27
I (1113) sccb: sccb_i2c_port=1

I (1123) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1163) camera: Detected camera at address=0x30
I (1173) camera: Detected OV2640 camera
I (1243) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (1333) cam_hal: buffer_size: 16384, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 8, total_cnt: 15
I (1333) cam_hal: Allocating 16 Byte frame buffer in PSRAM
I (1343) cam_hal: Allocating 16 Byte frame buffer in PSRAM
I (1353) cam_hal: Allocating 16 Byte frame buffer in PSRAM
I (1363) cam_hal: Allocating 16 Byte frame buffer in PSRAM
I (1373) cam_hal: Allocating 16 Byte frame buffer in PSRAM
I (1373) cam_hal: cam config ok
I (107433) main: cb 4096 bytes last
I (150183) main: cb 4096 bytes last
I (150243) main: cb 4096 bytes last
I (157383) main: cb 4096 bytes last
I (189173) main: cb 4096 bytes last

But it's veeery slow compared to Espressif's solution. I also don't know whether the data buffer is in PSRAM or in static DRAM (if it's in PSRAM I need to make a local copy to speed it up). The FPS is <1. I also don't know whether the input data is raw bytes or in jpeg. I think it's raw bytes and I need to pipe them in a buffer, convert to JPEG on last received and save to the file.

An example is needed.

Ncerzzk commented 1 year ago

hmm, let's go back from the beginning. If you just want to get picture and write to sd card, the origin master branch in esp32-camera is OK. in origin esp32-camera, they save data into frame buffer from dma buffer at each dma recv interrupt. when the picture is finished, you can get data which contains the whole frame by api.

in this project or my for-esp-cam-fpv branch, we don't need frame buffer, because we send the data to wifi/sd processes at each dma recv intterrupt.

come back to your code, if you still want to use the hacked esp32-camera: as .pixel_format = PIXFORMAT_JPEG , so the data you get definitely is jpeg. grab_mode please set to CAMERA_GRAB_LATEST don't directly use memcpy when handle the data, because there are only 1 valid byte in 4 bytes. please refer how we did in camera_data_available or ll_cam_memcpy in esp32-camera and data is dma buffer, and it's allocated in DRAM, not psram.

also, you should handle the start of jpeg(refer main.cpp) , or the data you write may not a valid jpeg.

dizcza commented 1 year ago

I see, so I misinterpreted the project description:

This project uses a modified esp-camera component running on an AI Thinker board to send low-latency mjpeg video to a Raspberry PI base station with 1-2 wifi cards using packet injection and monitor mode.

I thought this project comes up with some unverified hacks that speed up the camera capture acquisition process at expense of providing less support (platform-wise, different camera, different ESP-IDF, etc.) and potential data corruption (at higher speed I expect to see data loss in the captured frames).

If this project does not speed up camera capture process by any means or doesn't provide alternative ways to dump the data in callbacks that further decrease latency (like in callbacks of yours), I'll stick to Espressif's original version.