Try to allocate the frame buffer to internal RAM first

This commit is contained in:
Me No Dev
2019-02-14 17:07:09 +01:00
committed by GitHub
parent 7a1bd0839f
commit 113629b1cf

View File

@@ -219,9 +219,7 @@ static esp_err_t camera_fb_init(size_t count)
}
memset(_fb2, 0, sizeof(camera_fb_int_t));
_fb2->size = s_state->fb_size;
if(s_state->config.pixel_format == PIXFORMAT_JPEG) {
_fb2->buf = (uint8_t*) calloc(_fb2->size, 1);
}
_fb2->buf = (uint8_t*) calloc(_fb2->size, 1);
if(!_fb2->buf) {
ESP_LOGI(TAG, "Allocating %d KB frame buffer in PSRAM", s_state->fb_size/1024);
_fb2->buf = (uint8_t*) heap_caps_calloc(_fb2->size, 1, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);