This commit is contained in:
Rene Zeldenthuis
2024-03-19 13:45:22 +01:00
parent 2eb7a58e1c
commit 86ae9af574
6 changed files with 22 additions and 13 deletions

View File

@@ -9,6 +9,12 @@
#define OTA_PASSWORD "ESP32CAM-RTSP" #define OTA_PASSWORD "ESP32CAM-RTSP"
// Time servers
#define NTP_SERVER_1 "nl.pool.ntp.org"
#define NTP_SERVER_2 "europe.pool.ntp.org"
#define NTP_SERVER_3 "time.nist.gov"
#define NTP_SERVERS NTP_SERVER_1, NTP_SERVER_2, NTP_SERVER_3
#define RTSP_PORT 554 #define RTSP_PORT 554
#define DEFAULT_FRAME_DURATION 200 #define DEFAULT_FRAME_DURATION 200

View File

@@ -83,7 +83,6 @@ bool jpg::decode(const uint8_t *data, size_t size)
return false; return false;
} }
jpeg_data_size = ptr;
log_d("Total jpeg data = %d bytes", jpeg_data_end - jpeg_data_start); log_d("Total jpeg data = %d bytes", jpeg_data_end - jpeg_data_start);
return true; return true;

View File

@@ -7,7 +7,7 @@ class micro_rtsp_streamer
{ {
public: public:
micro_rtsp_streamer(); micro_rtsp_streamer();
void create_jpg_packet(const jpg jpg, uint32_t timestamp); size_t create_jpg_packet(const uint8_t *jpg, const uint8_t *jpg_end, uint32_t timestamp);
private : private :
uint32_t ssrc_; uint32_t ssrc_;

View File

@@ -1,6 +1,6 @@
#include "micro_rtsp_streamer.h" #include "micro_rtsp_streamer.h"
#include "rtp_payloads.h" //#include "rtp_payloads.h"
#include <stddef.h> #include <stddef.h>
@@ -11,13 +11,13 @@
// RTP data header (http://www.ietf.org/rfc/rfc3550.txt) // RTP data header (http://www.ietf.org/rfc/rfc3550.txt)
struct rtp_hdr struct rtp_hdr
{ {
uint version : 2; // protocol version uint16_t version : 2; // protocol version
uint p : 1; // padding flag uint16_t p : 1; // padding flag
uint x : 1; // header extension flag uint16_t x : 1; // header extension flag
uint cc : 4; // CSRC count uint16_t cc : 4; // CSRC count
uint m : 1; // marker bit uint16_t m : 1; // marker bit
uint pt : 7; // payload type uint16_t pt : 7; // payload type
uint seq : 16; // sequence number uint16_t seq : 16; // sequence number
uint32_t ts; // timestamp uint32_t ts; // timestamp
uint32_t ssrc; // synchronization source uint32_t ssrc; // synchronization source
uint32_t csrc[]; // optional CSRC list uint32_t csrc[]; // optional CSRC list
@@ -30,8 +30,8 @@ struct rtp_hdr
struct jpeghdr struct jpeghdr
{ {
uint322_t tspec : 8; // type-specific field uint32_t tspec : 8; // type-specific field
uint322_t off : 24; // fragment byte offset uint32_t off : 24; // fragment byte offset
uint8_t type; // id of jpeg decoder params uint8_t type; // id of jpeg decoder params
uint8_t q; // quantization factor (or table id) uint8_t q; // quantization factor (or table id)
uint8_t width; // frame width in 8 pixel blocks uint8_t width; // frame width in 8 pixel blocks

View File

@@ -58,7 +58,8 @@ board_build.embed_txtfiles =
lib_deps = lib_deps =
prampec/IotWebConf@^3.2.1 prampec/IotWebConf@^3.2.1
geeksville/Micro-RTSP@^0.1.6 geeksville/Micro-RTSP@^0.1.6
rzeldent/micro-moustache@^1.0.1 rzeldent/micro-moustache
rzeldent/micro-timezonedb
[env:esp32cam_ai_thinker] [env:esp32cam_ai_thinker]
board = esp32cam_ai_thinker board = esp32cam_ai_thinker

View File

@@ -392,6 +392,9 @@ void setup()
#endif #endif
iotWebConf.init(); iotWebConf.init();
// Set the time servers
configTime(0, 0, NTP_SERVERS);
// Try to initialize 3 times // Try to initialize 3 times
for (auto i = 0; i < 3; i++) for (auto i = 0; i < 3; i++)
{ {