Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
1acd2c1b
Commit
1acd2c1b
authored
Dec 29, 2023
by
schreibfaul1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
timeout if WiFiClient is not available
parent
349c6c97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
src/Audio.cpp
src/Audio.cpp
+21
-4
No files found.
src/Audio.cpp
View file @
1acd2c1b
...
...
@@ -4,7 +4,7 @@
* Created on: Oct 26.2018
*
* Version 3.0.8a
* Updated on: Dec 2
5
.2023
* Updated on: Dec 2
9
.2023
* Author: Wolle (schreibfaul1)
*
*/
...
...
@@ -2228,6 +2228,7 @@ void Audio::loop() {
host
=
parsePlaylist_M3U8
();
if
(
host
)
{
// host contains the next playlist URL
httpPrint
(
host
);
setDatamode
(
HTTP_RESPONSE_HEADER
);
}
else
{
// host == NULL means connect to m3u8 URL
httpPrint
(
m_lastM3U8host
);
...
...
@@ -3454,13 +3455,29 @@ void Audio::playAudioData() {
bool
Audio
::
parseHttpResponseHeader
()
{
// this is the response to a GET / request
if
(
getDatamode
()
!=
HTTP_RESPONSE_HEADER
)
return
false
;
if(_client->available() == 0) return false;
char rhl[512] = {0}; // responseHeaderline
bool ct_seen = false;
uint32_t
ctime
=
millis
();
uint32_t
timeout
=
2500
;
// ms
static
uint32_t
stime
;
static
bool
f_time
=
false
;
if
(
_client
->
available
()
==
0
){
if
(
!
f_time
){
stime
=
millis
();
f_time
=
true
;
}
if
((
millis
()
-
stime
)
>
timeout
)
{
log_e
(
"timeout"
);
f_time
=
false
;
return
false
;
}
}
f_time
=
false
;
char
rhl
[
512
]
=
{
0
};
// responseHeaderline
bool
ct_seen
=
false
;
while
(
true
)
{
// outer while
uint16_t
pos
=
0
;
if
((
millis
()
-
ctime
)
>
timeout
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment