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
ba9acdbb
Commit
ba9acdbb
authored
Feb 02, 2024
by
schreibfaul1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix err in memset()
parent
4812e9ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
src/opus_decoder/celt.cpp
src/opus_decoder/celt.cpp
+1
-1
src/opus_decoder/opus_decoder.cpp
src/opus_decoder/opus_decoder.cpp
+19
-15
No files found.
src/opus_decoder/celt.cpp
View file @
ba9acdbb
...
...
@@ -1516,7 +1516,7 @@ uint32_t quant_partition(int16_t *X, int32_t N, int32_t b, int32_t B, int16_t *l
cm_mask
=
(
uint32_t
)(
1UL
<<
B
)
-
1
;
fill
&=
cm_mask
;
if
(
!
fill
)
{
memset
(
&
X
,
0
,
N
*
sizeof
(
X
));
memset
(
X
,
0
,
N
*
sizeof
(
X
));
}
else
{
if
(
lowband
==
NULL
)
{
...
...
src/opus_decoder/opus_decoder.cpp
View file @
ba9acdbb
...
...
@@ -77,7 +77,6 @@ int OPUSDecode(uint8_t *inbuf, int *bytesLeft, short *outbuf){
static
uint16_t
fs
=
0
;
static
uint8_t
M
=
0
;
static
uint8_t
configNr
=
0
;
static
uint16_t
paddingBytes
=
0
;
uint8_t
paddingLength
=
0
;
static
uint16_t
samplesPerFrame
=
0
;
...
...
@@ -102,11 +101,12 @@ int OPUSDecode(uint8_t *inbuf, int *bytesLeft, short *outbuf){
s_opusSegmentTableSize
--
;
len
=
s_opusSegmentTable
[
s_opusSegmentTableRdPtr
];
}
configNr
=
parseOpusTOC
(
inbuf
[
0
]);
parseOpusTOC
(
inbuf
[
0
]);
samplesPerFrame
=
opus_packet_get_samples_per_frame
(
inbuf
,
s_opusSamplerate
);
}
FramePacking:
// https://www.tech-invite.com/y65/tinv-ietf-rfc-6716-2.html 3.2. Frame Packing
switch
(
s_opusCountCode
){
case
0
:
// Code 0: One Frame in the Packet
*
bytesLeft
-=
len
;
...
...
@@ -131,25 +131,29 @@ FramePacking: // https://www.tech-invite.com/y65/tinv-ietf-rfc-6716-2
bool
p
=
((
inbuf
[
1
]
&
0x40
)
==
0x40
);
// padding bit
M
=
inbuf
[
1
]
&
0x3F
;
// max framecount
// log_i("v %i, p %i, M %i", v, p, M);
paddingBytes
=
0
;
paddingLength
=
0
;
*
bytesLeft
-=
2
;
len
-=
2
;
inbuf
+=
2
;
if
(
p
){
paddingBytes
=
0
;
paddingLength
=
1
;
int
i
=
0
;
while
(
inbuf
[
2
+
i
]
==
255
){
paddingBytes
+=
inbuf
[
2
+
i
];
while
(
inbuf
[
i
]
==
255
){
paddingBytes
+=
inbuf
[
i
];
i
++
;
}
paddingBytes
+=
inbuf
[
2
+
i
];
fs
=
(
len
-
(
2
+
paddingLength
+
paddingBytes
))
/
M
;
*
bytesLeft
-=
(
3
+
i
);
paddingBytes
+=
inbuf
[
i
];
paddingLength
+=
i
;
inbuf
+=
2
+
paddingLength
;
// log_e("paddingBytes %i, len %i, fs %i", paddingBytes, len, fs);
*
bytesLeft
-=
paddingLength
;
len
-=
paddingLength
;
inbuf
+=
paddingLength
;
}
fs
=
(
len
-
paddingBytes
)
/
M
;
}
*
bytesLeft
-=
fs
;
// samplesPerFrame = opus_packet_get_samples_per_frame(inbuf, s_opusSamplerate);
ec_dec_init
((
uint8_t
*
)
inbuf
,
fs
);
ret
=
celt_decode_with_ec
(
inbuf
,
fs
,
(
int16_t
*
)
outbuf
,
samplesPerFrame
);
if
(
ret
<
0
)
goto
exit
;
// celt error
...
...
@@ -157,7 +161,7 @@ FramePacking: // https://www.tech-invite.com/y65/tinv-ietf-rfc-6716-2
M
--
;
// log_i("M %i fs %i spf %i", M, fs, samplesPerFrame);
ret
=
ERR_OPUS_NONE
;
if
(
M
==
0
)
{
s_opusCountCode
=
0
;
*
bytesLeft
-=
paddingBytes
;
goto
exit
;}
if
(
M
==
0
)
{
s_opusCountCode
=
0
;
*
bytesLeft
-=
paddingBytes
;
paddingBytes
=
0
;
goto
exit
;}
return
ret
;
break
;
default:
...
...
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