File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -2423,6 +2423,9 @@ void Audio::playChunk() {
24232423}
24242424// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
24252425void Audio::loop () {
2426+ static uint8_t interval_short_cnt = 0 ;
2427+ static uint32_t connect_host_time = millis ();
2428+
24262429 if (!m_f_running) return ;
24272430
24282431 if (m_playlistFormat != FORMAT_M3U8) { // normal process
@@ -2473,6 +2476,20 @@ void Audio::loop() {
24732476 else { // host == NULL means connect to m3u8 URL
24742477 if (m_lastM3U8host) httpPrint (m_lastM3U8host);
24752478 else httpPrint (m_lastHost); // if url has no first redirection
2479+
2480+ if (millis () - connect_host_time < 1000 ) {
2481+ if (++interval_short_cnt >= 5 ) { // connect to host too often (maybe cause by temporary bad network quality)
2482+ interval_short_cnt = 0 ;
2483+
2484+ AUDIO_INFO (" connect host interval too short, try to reconnect..." );
2485+ connecttohost (m_lastHost);
2486+ }
2487+ }
2488+ else {
2489+ interval_short_cnt = 0 ;
2490+ }
2491+ connect_host_time = millis ();
2492+
24762493 m_dataMode = HTTP_RESPONSE_HEADER; // we have a new playlist now
24772494 }
24782495 break ;
You can’t perform that action at this time.
0 commit comments