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
6bb1c183
Commit
6bb1c183
authored
13 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
opus_packet_parse() now returns the payload offset rather than the pointer
parent
8fe8b8e0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/opus.h
+1
-1
1 addition, 1 deletion
src/opus.h
src/opus_decoder.c
+7
-5
7 additions, 5 deletions
src/opus_decoder.c
with
8 additions
and
6 deletions
src/opus.h
+
1
−
1
View file @
6bb1c183
...
...
@@ -219,7 +219,7 @@ OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st);
OPUS_EXPORT
int
opus_packet_parse
(
const
unsigned
char
*
data
,
int
len
,
unsigned
char
*
out_toc
,
const
unsigned
char
*
frames
[
48
],
short
size
[
48
],
const
unsigned
char
*
*
payload
);
short
size
[
48
],
int
*
payload
_offset
);
OPUS_EXPORT
int
opus_packet_get_bandwidth
(
const
unsigned
char
*
data
);
OPUS_EXPORT
int
opus_packet_get_samples_per_frame
(
const
unsigned
char
*
data
,
int
Fs
);
...
...
This diff is collapsed.
Click to expand it.
src/opus_decoder.c
+
7
−
5
View file @
6bb1c183
...
...
@@ -446,12 +446,13 @@ static int parse_size(const unsigned char *data, int len, short *size)
int
opus_packet_parse
(
const
unsigned
char
*
data
,
int
len
,
unsigned
char
*
out_toc
,
const
unsigned
char
*
frames
[
48
],
short
size
[
48
],
const
unsigned
char
*
*
payload
)
short
size
[
48
],
int
*
payload
_offset
)
{
int
i
,
bytes
;
int
count
;
unsigned
char
ch
,
toc
;
int
framesize
;
const
unsigned
char
*
data0
=
data
;
if
(
size
==
NULL
)
return
OPUS_BAD_ARG
;
...
...
@@ -556,8 +557,8 @@ int opus_packet_parse(const unsigned char *data, int len,
if
(
out_toc
)
*
out_toc
=
toc
;
if
(
payload
)
*
payload
=
data
;
if
(
payload
_offset
)
*
payload
_offset
=
data
-
data0
;
return
count
;
}
...
...
@@ -571,7 +572,7 @@ int opus_decode_float(OpusDecoder *st, const unsigned char *data,
#endif
{
int
i
,
nb_samples
;
int
count
;
int
count
,
offset
;
unsigned
char
toc
;
/* 48 x 2.5 ms = 120 ms */
short
size
[
48
];
...
...
@@ -584,10 +585,11 @@ int opus_decode_float(OpusDecoder *st, const unsigned char *data,
st
->
frame_size
=
opus_packet_get_samples_per_frame
(
data
,
st
->
Fs
);
st
->
stream_channels
=
opus_packet_get_nb_channels
(
data
);
count
=
opus_packet_parse
(
data
,
len
,
&
toc
,
NULL
,
size
,
&
data
);
count
=
opus_packet_parse
(
data
,
len
,
&
toc
,
NULL
,
size
,
&
offset
);
if
(
count
<
0
)
return
count
;
data
+=
offset
;
if
(
count
*
st
->
frame_size
>
frame_size
)
return
OPUS_BAD_ARG
;
nb_samples
=
0
;
...
...
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