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
974fa469
Unverified
Commit
974fa469
authored
Nov 21, 2022
by
Wolle
Committed by
GitHub
Nov 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce maxFrameSize for wav
parent
ed1edd2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
src/Audio.cpp
src/Audio.cpp
+9
-13
src/Audio.h
src/Audio.h
+2
-2
No files found.
src/Audio.cpp
View file @
974fa469
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
*
*
* Created on: Oct 26.2018
* Created on: Oct 26.2018
*
*
* Version 2.0.6
r
* Version 2.0.6
s
* Updated on: Nov
18
.2022
* Updated on: Nov
21
.2022
* Author: Wolle (schreibfaul1)
* Author: Wolle (schreibfaul1)
*
*
*/
*/
...
@@ -2865,16 +2865,11 @@ void Audio::processLocalFile() {
...
@@ -2865,16 +2865,11 @@ void Audio::processLocalFile() {
byteCounter
=
0
;
byteCounter
=
0
;
pos_stsz
=
0
;
pos_stsz
=
0
;
if
(
m_codec
==
CODEC_M4A
)
pos_stsz
=
seek_m4a_stsz
(
&
stszEntries
);
// returns the pos of atom stsz
if
(
m_codec
==
CODEC_M4A
)
pos_stsz
=
seek_m4a_stsz
(
&
stszEntries
);
// returns the pos of atom stsz
log_i
(
"pos_stsz %x, stszEntries %d"
,
pos_stsz
,
stszEntries
);
return
;
return
;
}
}
(
void
)
pos_stsz
;
(
void
)
pos_stsz
;
#ifdef CONFIG_IDF_TARGET_ESP32S3
availableBytes
=
16
*
1024
;
availableBytes
=
maxFrameSize
*
4
;
#else // Audiobuffer throttle - - -
availableBytes
=
maxFrameSize
;
// reduce blocksize because PSRAM is too slow
#endif
availableBytes
=
min
(
availableBytes
,
InBuff
.
writeSpace
());
availableBytes
=
min
(
availableBytes
,
InBuff
.
writeSpace
());
availableBytes
=
min
(
availableBytes
,
audiofile
.
size
()
-
byteCounter
);
availableBytes
=
min
(
availableBytes
,
audiofile
.
size
()
-
byteCounter
);
...
@@ -2891,14 +2886,16 @@ void Audio::processLocalFile() {
...
@@ -2891,14 +2886,16 @@ void Audio::processLocalFile() {
byteCounter
+=
bytesAddedToBuffer
;
// Pull request #42
byteCounter
+=
bytesAddedToBuffer
;
// Pull request #42
InBuff
.
bytesWritten
(
bytesAddedToBuffer
);
InBuff
.
bytesWritten
(
bytesAddedToBuffer
);
}
}
if
(
!
f_stream
){
if
(
!
f_stream
){
if
(
m_controlCounter
!=
100
)
{
if
(
m_controlCounter
!=
100
)
{
if
(
InBuff
.
bufferFilled
()
>
maxFrameSize
){
// read the file header first
if
(
InBuff
.
bufferFilled
()
>
maxFrameSize
){
// read the file header first
InBuff
.
bytesWasRead
(
readAudioHeader
(
InBuff
.
bufferFilled
()));
InBuff
.
bytesWasRead
(
readAudioHeader
(
InBuff
.
bufferFilled
()));
}
}
return
;
return
;
}
}
# ifndef CONFIG_IDF_TARGET_ESP32S
if
((
InBuff
.
freeSpace
()
>
maxFrameSize
)
&&
(
m_file_size
-
byteCounter
)
>
maxFrameSize
)
return
;
# endif
else
{
else
{
f_stream
=
true
;
f_stream
=
true
;
AUDIO_INFO
(
"stream ready"
);
AUDIO_INFO
(
"stream ready"
);
...
@@ -2966,11 +2963,10 @@ void Audio::processLocalFile() {
...
@@ -2966,11 +2963,10 @@ void Audio::processLocalFile() {
static
uint8_t
cnt
=
0
;
static
uint8_t
cnt
=
0
;
uint8_t
compression
;
uint8_t
compression
;
if
(
m_codec
==
CODEC_WAV
)
compression
=
1
;
if
(
m_codec
==
CODEC_WAV
)
compression
=
1
;
if
(
m_codec
==
CODEC_FLAC
)
compression
=
2
;
else
if
(
m_codec
==
CODEC_FLAC
)
compression
=
2
;
compression
=
6
;
else
compression
=
3
;
cnt
++
;
cnt
++
;
if
(
cnt
==
compression
){
playAudioData
();
cnt
=
0
;}
if
(
cnt
==
compression
){
playAudioData
();
cnt
=
0
;}
playAudioData
();
}
}
return
;
return
;
}
}
...
...
src/Audio.h
View file @
974fa469
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* Audio.h
* Audio.h
*
*
* Created on: Oct 28,2018
* Created on: Oct 28,2018
* Updated on: Nov
18
,2022
* Updated on: Nov
21
,2022
* Author: Wolle (schreibfaul1)
* Author: Wolle (schreibfaul1)
*/
*/
...
@@ -469,7 +469,7 @@ private:
...
@@ -469,7 +469,7 @@ private:
std
::
vector
<
char
*>
m_playlistURL
;
// m3u8 streamURLs buffer
std
::
vector
<
char
*>
m_playlistURL
;
// m3u8 streamURLs buffer
std
::
vector
<
uint32_t
>
m_hashQueue
;
std
::
vector
<
uint32_t
>
m_hashQueue
;
const
size_t
m_frameSizeWav
=
1024
*
8
;
const
size_t
m_frameSizeWav
=
1024
;
const
size_t
m_frameSizeMP3
=
1600
;
const
size_t
m_frameSizeMP3
=
1600
;
const
size_t
m_frameSizeAAC
=
1600
;
const
size_t
m_frameSizeAAC
=
1600
;
const
size_t
m_frameSizeFLAC
=
4096
*
4
;
const
size_t
m_frameSizeFLAC
=
4096
*
4
;
...
...
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