I can try and re-flash the camera/processor with the demos in a few days, but it’s currently in regular use, dropped-frames and all.
I’m assuming the demos on github will be the same as the latest Arduino update for the AMB82-mini. If not, please let me know what difference I’d be able to expect.
I’m not intentionally using UDP - the code is pseudo-streaming motion JPEG over http, in a manner similar to the example HTTPDisplyJPEGContinuous, though not the same: my application can serve multiple http endpoints simultaneously (though I see these pauses with only a single endpoint connected, as well as with multiple endpoints).
If UDP is in use, it’s nothing I’ve set up; I expect that the http service is using TCP/IP. The internals of the WiFiServer are opaque to me.
very pseudocode:
// pick up WiFi Credentials
getWiFiCreds(path, ssid, wifipw);
// Connect to WiFi
WiFi.begin(ssid, wifipw);
// Start the server
server.setNonBlockingMode();
server.begin();
// parse http request
// serve http camera image HEAD
void CameraView::serveChunk(WiFiClient& client) {
// get the location and length of this frame data
myCamera.getImage(CHANNEL, &img_addr, &img_len);
// clear the buffer
memset(CameraView::chunk_buf,0,sizeof(CameraView::chunk_buf));
chunk_len = snprintf((char*)CameraView::chunk_buf, 64, IMG_HEADER, img_len);
sendChunk(client, CameraView::chunk_buf, chunk_len); // Content-Type: image/jpeg\r\nContent-len: 123456\r\n\r\n, 49
sendChunk(client, (uint8_t*)img_addr, img_len); // {image data (a frame)}, 123456
sendChunk(client, (uint8_t*)STREAM_BOUNDARY, strlen(STREAM_BOUNDARY)); // \r\n--123456789000000000000987654321\r\n, 36
delay(2);
}
void CameraView::sendChunk(WiFiClient& client, uint8_t* buf, uint32_t len) {
uint8_t ch_buf[64] = {0};
uint8_t ch_len = snprintf((char*)ch_buf, 64, "%lX\r\n", len);
client.write(ch_buf, ch_len);
client.write(buf, len);
client.print("\r\n");
}
It’s been a couple months, but recalling how I cobbled things together, some of the code would’ve been cribbed directly from the JPEG over HTTP example code.