Skip to content

Commit 6996a89

Browse files
committed
HLSStream defines
1 parent b80749e commit 6996a89

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/AudioTools/AudioLibs/HLSStream.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define HLS_BUFFER_COUNT 2
1111
#define HLS_MAX_NO_READ 2
1212
#define HLS_MAX_URL_LEN 256
13+
#define HLS_TIMEOUT 5000
1314

1415
/// hide hls implementation in it's own namespace
1516

@@ -129,9 +130,9 @@ class URLLoaderHLS {
129130
LOGI("playing %s", url_to_play);
130131
p_stream->end();
131132
p_stream->setConnectionClose(true);
132-
p_stream->setTimeout(5000);
133+
p_stream->setTimeout(HLS_TIMEOUT);
133134
p_stream->begin(url_to_play);
134-
p_stream->waitForData(5000);
135+
p_stream->waitForData(HLS_TIMEOUT);
135136
urls.pop_front();
136137
// assert(urls[0]!=url);
137138

@@ -345,9 +346,9 @@ class HLSParser {
345346
/// Default implementation for url resolver: determine absolue url from
346347
/// relative url
347348
static const char *resolveURL(const char *segment, const char *reqURL) {
348-
static char result[HLS_MAX_URL_LEN] = {
349-
0}; // avoid dynamic memory allocation
350-
StrView result_str(result, 256);
349+
// avoid dynamic memory allocation
350+
static char result[HLS_MAX_URL_LEN] = {0};
351+
StrView result_str(result, HLS_MAX_URL_LEN);
351352
StrView index_url(reqURL);
352353
// Use prefix up to ? or laast /
353354
int end = index_url.lastIndexOf("?");
@@ -387,7 +388,7 @@ class HLSParser {
387388
bool parseIndex() {
388389
TRACED();
389390
url_stream.end();
390-
url_stream.setTimeout(5000);
391+
url_stream.setTimeout(HLS_TIMEOUT);
391392
url_stream.setConnectionClose(true);
392393
if (!url_stream.begin(index_url_str)) return false;
393394
url_active = true;
@@ -469,7 +470,7 @@ class HLSParser {
469470
return true;
470471
}
471472

472-
void resetTimings(){
473+
void resetTimings() {
473474
next_sement_load_time_planned = millis();
474475
play_time = 0;
475476
next_sement_load_time = 0xFFFFFFFFFFFFFFFF;
@@ -518,15 +519,15 @@ class HLSParser {
518519
return true;
519520
}
520521

521-
void segmentsActivate(){
522+
void segmentsActivate() {
522523
LOGI("Reloading in %f sec", play_time / 1000.0);
523524
if (play_time > 0) {
524525
next_sement_load_time = next_sement_load_time_planned + play_time;
525526
}
526527

527528
// we request a minimum of collected urls to play before we start
528529
if (url_history.size() > START_URLS_LIMIT) active = true;
529-
parse_segments_active = false;
530+
parse_segments_active = false;
530531
}
531532

532533
/// parse the segments

0 commit comments

Comments
 (0)