From df119daa827bb5f5ceb8d834b6f387bd31312037 Mon Sep 17 00:00:00 2001 From: jarethmt <35903402+jarethmt@users.noreply.github.com> Date: Fri, 23 Sep 2022 21:39:08 -0400 Subject: [PATCH] Fixing issues with jpg endpoint JPG endpoint used to initialize a new camera instance and take a snapshot. On some chips, this would cause the driver to error out and the entire camera to become unresponsive until a reboot. This change utilizes the frame held in the buffer and delivers it instead to prevent any errors. --- esp32_camera_mjpeg_multiclient.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esp32_camera_mjpeg_multiclient.ino b/esp32_camera_mjpeg_multiclient.ino index 9a998d3..df49aa8 100644 --- a/esp32_camera_mjpeg_multiclient.ino +++ b/esp32_camera_mjpeg_multiclient.ino @@ -359,9 +359,10 @@ void handleJPG(void) WiFiClient client = server.client(); if (!client.connected()) return; - cam.run(); + xSemaphoreTake( frameSync, portMAX_DELAY ); client.write(JHEADER, jhdLen); - client.write((char*)cam.getfb(), cam.getSize()); + client.write((char*) camBuf, (size_t)camSize); + xSemaphoreGive( frameSync ); }