Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Traud
Opus
Commits
dbc83d31
Commit
dbc83d31
authored
11 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning up multistream packet validation
parent
970d0529
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/opus_multistream_decoder.c
+9
-15
9 additions, 15 deletions
src/opus_multistream_decoder.c
with
9 additions
and
15 deletions
src/opus_multistream_decoder.c
+
9
−
15
View file @
dbc83d31
...
...
@@ -153,7 +153,7 @@ typedef void (*opus_copy_channel_out_func)(
);
static
int
opus_multistream_packet_validate
(
const
unsigned
char
*
data
,
opus_int32
len
,
int
nb_streams
)
opus_int32
len
,
int
nb_streams
,
opus_int32
Fs
)
{
int
s
;
int
i
;
...
...
@@ -173,14 +173,14 @@ static int opus_multistream_packet_validate(const unsigned char *data,
return
count
;
for
(
i
=
0
;
i
<
count
;
i
++
)
offset
+=
size
[
i
];
tmp_samples
=
opus_packet_get_nb_samples
(
data
,
offset
,
48000
);
tmp_samples
=
opus_packet_get_nb_samples
(
data
,
offset
,
Fs
);
if
(
s
!=
0
&&
samples
!=
tmp_samples
)
return
OPUS_INVALID_PACKET
;
samples
=
tmp_samples
;
data
+=
offset
;
len
-=
offset
;
}
return
OPUS_OK
;
return
samples
;
}
static
int
opus_multistream_decode_native
(
...
...
@@ -225,11 +225,15 @@ static int opus_multistream_decode_native(
}
if
(
!
do_plc
)
{
int
ret
=
opus_multistream_packet_validate
(
data
,
len
,
st
->
layout
.
nb_coupled_streams
);
int
ret
=
opus_multistream_packet_validate
(
data
,
len
,
st
->
layout
.
nb_coupled_streams
,
Fs
);
if
(
ret
<
0
)
{
RESTORE_STACK
;
return
ret
;
}
else
if
(
ret
>
frame_size
)
{
RESTORE_STACK
;
return
OPUS_BUFFER_TOO_SMALL
;
}
}
for
(
s
=
0
;
s
<
st
->
layout
.
nb_streams
;
s
++
)
...
...
@@ -243,22 +247,12 @@ static int opus_multistream_decode_native(
if
(
!
do_plc
&&
len
<=
0
)
{
RESTORE_STACK
;
return
OPUS_IN
VALID_PACKET
;
return
OPUS_IN
TERNAL_ERROR
;
}
packet_offset
=
0
;
ret
=
opus_decode_native
(
dec
,
data
,
len
,
buf
,
frame_size
,
decode_fec
,
s
!=
st
->
layout
.
nb_streams
-
1
,
&
packet_offset
,
soft_clip
);
data
+=
packet_offset
;
len
-=
packet_offset
;
if
(
ret
>
frame_size
)
{
RESTORE_STACK
;
return
OPUS_BUFFER_TOO_SMALL
;
}
if
(
s
>
0
&&
ret
!=
frame_size
)
{
RESTORE_STACK
;
return
OPUS_INVALID_PACKET
;
}
if
(
ret
<=
0
)
{
RESTORE_STACK
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment