Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
libopusenc
Commits
01aecb28
Unverified
Commit
01aecb28
authored
May 07, 2017
by
Jean-Marc Valin
Browse files
Computing the exact (I think) padding size
parent
84ccf379
Changes
1
Show whitespace changes
Inline
Side-by-side
src/opusenc.c
View file @
01aecb28
...
...
@@ -620,11 +620,11 @@ OPE_EXPORT int ope_get_page(OggOpusEnc *enc, unsigned char **page, int *len, int
static
void
extend_signal
(
float
*
x
,
int
before
,
int
after
,
int
channels
);
int
ope_drain
(
OggOpusEnc
*
enc
)
{
int
pad_samples
;
if
(
enc
->
unrecoverable
)
return
OPE_UNRECOVERABLE
;
/* Check if it's already been drained. */
if
(
enc
->
streams
==
NULL
)
return
OPE_TOO_LATE
;
/* FIXME: Use a better value. */
int
pad_samples
=
3000
;
pad_samples
=
MAX
(
LPC_PADDING
,
enc
->
global_granule_offset
+
enc
->
frame_size
);
if
(
!
enc
->
streams
->
stream_is_init
)
init_stream
(
enc
);
shift_buffer
(
enc
);
assert
(
enc
->
buffer_end
+
pad_samples
<=
BUFFER_SAMPLES
);
...
...
@@ -634,6 +634,8 @@ int ope_drain(OggOpusEnc *enc) {
enc
->
buffer_end
+=
pad_samples
;
assert
(
enc
->
buffer_end
<=
BUFFER_SAMPLES
);
encode_buffer
(
enc
);
if
(
enc
->
unrecoverable
)
return
OPE_UNRECOVERABLE
;
/* Draining should have called all the streams to complete. */
assert
(
enc
->
streams
==
NULL
);
return
OPE_OK
;
}
...
...
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