|
@@ -1415,17 +1415,16 @@ esp_err_t CCamera::CaptureToStream(httpd_req_t *req, bool FlashlightOn)
|
|
|
{
|
|
{
|
|
|
if (fb->len > frameCopyCapacity)
|
|
if (fb->len > frameCopyCapacity)
|
|
|
{
|
|
{
|
|
|
- uint8_t *newBuffer = static_cast<uint8_t *>(malloc_psram_heap(
|
|
|
|
|
- "Live stream JPEG copy", fb->len, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
|
|
|
|
|
|
|
+ uint8_t *newBuffer = static_cast<uint8_t *>(realloc_psram_heap(
|
|
|
|
|
+ "Live stream JPEG copy", frameCopyBuffer, fb->len,
|
|
|
|
|
+ MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
|
|
|
if (newBuffer == NULL)
|
|
if (newBuffer == NULL)
|
|
|
{
|
|
{
|
|
|
- LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "CaptureToStream: JPEG copy allocation failed");
|
|
|
|
|
|
|
+ LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "CaptureToStream: JPEG copy buffer growth failed");
|
|
|
result = ESP_ERR_NO_MEM;
|
|
result = ESP_ERR_NO_MEM;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- if (frameCopyBuffer != NULL)
|
|
|
|
|
- free_psram_heap("Live stream JPEG copy", frameCopyBuffer);
|
|
|
|
|
frameCopyBuffer = newBuffer;
|
|
frameCopyBuffer = newBuffer;
|
|
|
frameCopyCapacity = fb->len;
|
|
frameCopyCapacity = fb->len;
|
|
|
}
|
|
}
|