Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Mar 19, 2024
1 parent 2eb7a58 commit 86ae9af
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
6 changes: 6 additions & 0 deletions include/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

#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 DEFAULT_FRAME_DURATION 200
Expand Down
1 change: 0 additions & 1 deletion lib/micro-jpg/src/jpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ bool jpg::decode(const uint8_t *data, size_t size)
return false;
}

jpeg_data_size = ptr;
log_d("Total jpeg data = %d bytes", jpeg_data_end - jpeg_data_start);

return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/micro-rtsp-server/include/micro_rtsp_streamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class micro_rtsp_streamer
{
public:
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 :

uint32_t ssrc_;
Expand Down
20 changes: 10 additions & 10 deletions lib/micro-rtsp-server/src/micro_rtsp_streamer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "micro_rtsp_streamer.h"

#include "rtp_payloads.h"
//#include "rtp_payloads.h"

#include <stddef.h>

Expand All @@ -11,13 +11,13 @@
// RTP data header (http://www.ietf.org/rfc/rfc3550.txt)
struct rtp_hdr
{
uint version : 2; // protocol version
uint p : 1; // padding flag
uint x : 1; // header extension flag
uint cc : 4; // CSRC count
uint m : 1; // marker bit
uint pt : 7; // payload type
uint seq : 16; // sequence number
uint16_t version : 2; // protocol version
uint16_t p : 1; // padding flag
uint16_t x : 1; // header extension flag
uint16_t cc : 4; // CSRC count
uint16_t m : 1; // marker bit
uint16_t pt : 7; // payload type
uint16_t seq : 16; // sequence number
uint32_t ts; // timestamp
uint32_t ssrc; // synchronization source
uint32_t csrc[]; // optional CSRC list
Expand All @@ -30,8 +30,8 @@ struct rtp_hdr

struct jpeghdr
{
uint322_t tspec : 8; // type-specific field
uint322_t off : 24; // fragment byte offset
uint32_t tspec : 8; // type-specific field
uint32_t off : 24; // fragment byte offset
uint8_t type; // id of jpeg decoder params
uint8_t q; // quantization factor (or table id)
uint8_t width; // frame width in 8 pixel blocks
Expand Down
3 changes: 2 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ board_build.embed_txtfiles =
lib_deps =
prampec/IotWebConf@^3.2.1
geeksville/Micro-RTSP@^0.1.6
rzeldent/micro-moustache@^1.0.1
rzeldent/micro-moustache
rzeldent/micro-timezonedb

[env:esp32cam_ai_thinker]
board = esp32cam_ai_thinker
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ void setup()
#endif
iotWebConf.init();

// Set the time servers
configTime(0, 0, NTP_SERVERS);

// Try to initialize 3 times
for (auto i = 0; i < 3; i++)
{
Expand Down

0 comments on commit 86ae9af

Please sign in to comment.