Compare commits

...

4 Commits

Author SHA1 Message Date
philippe44
922367baf5 no false alarm on OggS miss + homogeneous use of u32/size_t/int - release 2024-01-04 00:46:36 -08:00
philippe44
01320db007 always copy granule unless it's -1 (not valid) 2024-01-03 23:47:00 -08:00
philippe44
f677695fc7 handle pages with no terminated packet 2024-01-03 23:25:08 -08:00
github-actions
7902af2bf0 Update prebuilt objects [skip actions] 2024-01-03 04:08:04 +00:00
17 changed files with 38 additions and 28 deletions

View File

@@ -63,7 +63,8 @@ struct EXT_RAM_ATTR streamstate stream;
static EXT_RAM_ATTR struct {
enum { OGG_OFF, OGG_SYNC, OGG_HEADER, OGG_SEGMENTS, OGG_PAGE } state;
u32_t want, miss, match;
size_t want, miss, match;
u64_t granule;
u8_t* data, segments[255];
#pragma pack(push, 1)
struct {
@@ -128,7 +129,6 @@ static int _poll(SSL *ssl, struct pollfd *pollinfo, int timeout) {
}
#endif
static bool send_header(void) {
char *ptr = stream.header;
int len = stream.header_len;
@@ -177,8 +177,8 @@ static void _disconnect(stream_state state, disconnect_code disconnect) {
wake_controller();
}
static u32_t memfind(const u8_t* haystack, u32_t n, const char* needle, u32_t len, u32_t *offset) {
int i;
static size_t memfind(const u8_t* haystack, size_t n, const char* needle, size_t len, size_t* offset) {
size_t i;
for (i = 0; i < n && *offset != len; i++) *offset = (haystack[i] == needle[*offset]) ? *offset + 1 : 0;
return i;
}
@@ -204,7 +204,7 @@ static void stream_ogg(size_t n) {
if (consumed) break;
// we have to memorize position in case any of last 3 bytes match...
int pos = memfind(p, n, "OggS", 4, &ogg.match);
size_t pos = memfind(p, n, "OggS", 4, &ogg.match);
if (ogg.match == 4) {
consumed = pos - ogg.match;
ogg.state = OGG_HEADER;
@@ -212,7 +212,9 @@ static void stream_ogg(size_t n) {
ogg.data = (u8_t*) &ogg.header;
ogg.match = 0;
} else {
LOG_INFO("OggS not at expected position");
if (!ogg.match) {
LOG_INFO("OggS not at expected position %zu/%zu", pos, n);
}
return;
}
break;
@@ -229,10 +231,10 @@ static void stream_ogg(size_t n) {
break;
case OGG_SEGMENTS:
// calculate size of page using lacing values
for (int i = 0; i < ogg.want; i++) ogg.miss += ogg.data[i];
for (size_t i = 0; i < ogg.want; i++) ogg.miss += ogg.data[i];
ogg.want = ogg.miss;
if (ogg.header.granule == 0) {
if (ogg.header.granule == 0 || (ogg.header.granule == -1 && ogg.granule == 0)) {
// granule 0 means a new stream, so let's look into it
ogg.state = OGG_PAGE;
ogg.data = malloc(ogg.want);
@@ -241,13 +243,16 @@ static void stream_ogg(size_t n) {
ogg.state = OGG_SYNC;
ogg.data = NULL;
}
// memorize granule for next page
if (ogg.header.granule != -1) ogg.granule = ogg.header.granule;
break;
case OGG_PAGE: {
u32_t offset = 0;
size_t offset = 0;
// try to find one of valid Ogg pattern (vorbis, opus)
for (char** tag = (char*[]) { "\x3vorbis", "OpusTags", NULL }; *tag; tag++, offset = 0) {
u32_t pos = memfind(ogg.data, ogg.want, *tag, strlen(*tag), &offset);
size_t pos = memfind(ogg.data, ogg.want, *tag, strlen(*tag), &offset);
if (offset != strlen(*tag)) continue;
// u32:len,char[]:vendorId, u32:N, N x (u32:len,char[]:comment)
@@ -271,6 +276,7 @@ static void stream_ogg(size_t n) {
stream.header[stream.header_len++] = len;
memcpy(stream.header + stream.header_len, p, len);
stream.header_len += len;
LOG_INFO("metadata: %.*s", len, p);
}
}
@@ -280,6 +286,7 @@ static void stream_ogg(size_t n) {
break;
}
free(ogg.data);
ogg.data = NULL;
ogg.state = OGG_SYNC;
break;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -74,6 +74,8 @@ declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
@@ -226,6 +228,7 @@ declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare let sd: {};
declare let rf: boolean;
declare function refreshStatus(): void;

View File

@@ -1,5 +1,5 @@
target_add_binary_data( __idf_wifi-manager webapp/dist/css/index.4bbe29a78a667faa2b6f.css.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/favicon-32x32.png BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/index.html.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.c8ae2b.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.c8ae2b.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.baf383.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.baf383.bundle.js.gz BINARY)

View File

@@ -6,29 +6,29 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
extern const uint8_t _index_c8ae2b_bundle_js_gz_start[] asm("_binary_index_c8ae2b_bundle_js_gz_start");
extern const uint8_t _index_c8ae2b_bundle_js_gz_end[] asm("_binary_index_c8ae2b_bundle_js_gz_end");
extern const uint8_t _node_vendors_c8ae2b_bundle_js_gz_start[] asm("_binary_node_vendors_c8ae2b_bundle_js_gz_start");
extern const uint8_t _node_vendors_c8ae2b_bundle_js_gz_end[] asm("_binary_node_vendors_c8ae2b_bundle_js_gz_end");
extern const uint8_t _index_baf383_bundle_js_gz_start[] asm("_binary_index_baf383_bundle_js_gz_start");
extern const uint8_t _index_baf383_bundle_js_gz_end[] asm("_binary_index_baf383_bundle_js_gz_end");
extern const uint8_t _node_vendors_baf383_bundle_js_gz_start[] asm("_binary_node_vendors_baf383_bundle_js_gz_start");
extern const uint8_t _node_vendors_baf383_bundle_js_gz_end[] asm("_binary_node_vendors_baf383_bundle_js_gz_end");
const char * resource_lookups[] = {
"/css/index.4bbe29a78a667faa2b6f.css.gz",
"/favicon-32x32.png",
"/index.html.gz",
"/js/index.c8ae2b.bundle.js.gz",
"/js/node_vendors.c8ae2b.bundle.js.gz",
"/js/index.baf383.bundle.js.gz",
"/js/node_vendors.baf383.bundle.js.gz",
""
};
const uint8_t * resource_map_start[] = {
_index_4bbe29a78a667faa2b6f_css_gz_start,
_favicon_32x32_png_start,
_index_html_gz_start,
_index_c8ae2b_bundle_js_gz_start,
_node_vendors_c8ae2b_bundle_js_gz_start
_index_baf383_bundle_js_gz_start,
_node_vendors_baf383_bundle_js_gz_start
};
const uint8_t * resource_map_end[] = {
_index_4bbe29a78a667faa2b6f_css_gz_end,
_favicon_32x32_png_end,
_index_html_gz_end,
_index_c8ae2b_bundle_js_gz_end,
_node_vendors_c8ae2b_bundle_js_gz_end
_index_baf383_bundle_js_gz_end,
_node_vendors_baf383_bundle_js_gz_end
};

View File

@@ -1,6 +1,6 @@
/***********************************
webpack_headers
dist/css/index.4bbe29a78a667faa2b6f.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.c8ae2b.bundle.js.gz,dist/js/node_vendors.c8ae2b.bundle.js.gz
dist/css/index.4bbe29a78a667faa2b6f.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.baf383.bundle.js.gz,dist/js/node_vendors.baf383.bundle.js.gz
***********************************/
#pragma once
#include <inttypes.h>

Binary file not shown.

BIN
server_certs/r2m01.cer.45 Normal file

Binary file not shown.