Skip to content

Commit 12ca367

Browse files
committed
mjpeg: MjpegController logging
1 parent e7d68e6 commit 12ca367

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/esp32cam/asyncweb.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ MjpegResponse::_fillBuffer(uint8_t* buf, size_t buflen) {
145145
switch (act) {
146146
case Ctrl::RETURN: {
147147
if (auto frame = m_task.retrieve(); frame) {
148-
MJPEG_LOG("frame has %zu octets", frame->size());
149148
m_ctrl.notifyReturn(std::move(frame));
150149
}
151150
m_sendNext = SIPartHeader;
@@ -160,7 +159,6 @@ MjpegResponse::_fillBuffer(uint8_t* buf, size_t buflen) {
160159
size_t len = sendPart(buf, buflen);
161160
if (len == 0 && m_sendNext == SINone) {
162161
m_ctrl.notifySent(true);
163-
MJPEG_LOG("sent to client");
164162
} else {
165163
return len;
166164
}
@@ -173,11 +171,9 @@ MjpegResponse::_fillBuffer(uint8_t* buf, size_t buflen) {
173171
case Ctrl::CAPTURE: {
174172
m_task.request();
175173
m_ctrl.notifyCapture();
176-
MJPEG_LOG("capturing");
177174
return RESPONSE_TRY_AGAIN;
178175
}
179176
case Ctrl::STOP:
180-
MJPEG_LOG("stopping");
181177
return 0;
182178
default:
183179
return RESPONSE_TRY_AGAIN;

src/esp32cam/camera.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
namespace esp32cam {
77

8-
// extern ESP32CAM_SPECIALIZE_SENSOR_SETTING(framesize_t, framesize_t);
9-
10-
// static SensorSetting<framesize_t, framesize_t> frameSize(ESP32CAM_SENSOR_OFFSETS(framesize));
11-
128
Print* LogOutput = nullptr;
139
CameraClass Camera;
1410

src/esp32cam/mjpeg.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "mjpeg.hpp"
2+
#include "logger.hpp"
23

3-
#include <Arduino.h>
4+
#define MC_LOG(fmt, ...) ESP32CAM_LOG("MjpegController(%p) " fmt, this, ##__VA_ARGS__)
45

56
namespace esp32cam {
67
namespace detail {
@@ -25,21 +26,26 @@ void
2526
MjpegController::notifyCapture() {
2627
m_nextAction = RETURN;
2728
m_nextCaptureTime = millis() + static_cast<unsigned long>(m_cfg.minInterval);
29+
MC_LOG("notifyCapture next=%lu", m_nextCaptureTime);
2830
}
2931

3032
void
3133
MjpegController::notifyReturn(std::unique_ptr<Frame> frame) {
3234
if (frame == nullptr) {
35+
MC_LOG("notifyReturn frame=nullptr");
3336
notifyFail();
3437
return;
3538
}
3639
m_frame = std::move(frame);
40+
MC_LOG("notifyReturn frame=%p size=%zu dimension=%dx%d", m_frame->data(), m_frame->size(),
41+
m_frame->getWidth(), m_frame->getHeight());
3742
m_nextAction = SEND;
3843
}
3944

4045
void
4146
MjpegController::notifySent(bool ok) {
4247
++m_count;
48+
MC_LOG("notifySent count=%d ok=%d", m_count, static_cast<int>(ok));
4349
if (!ok) {
4450
notifyFail();
4551
return;
@@ -50,6 +56,7 @@ MjpegController::notifySent(bool ok) {
5056

5157
void
5258
MjpegController::notifyFail() {
59+
MC_LOG("notifyFail");
5360
m_frame.reset();
5461
m_nextAction = STOP;
5562
}

0 commit comments

Comments
 (0)