Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libopusenc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
libopusenc
Commits
7c9e932f
Unverified
Commit
7c9e932f
authored
Feb 04, 2018
by
Jean-Marc Valin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't trim the last frame below 20 ms to avoid switching mode
parent
63c69484
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/opusenc.c
src/opusenc.c
+8
-3
No files found.
src/opusenc.c
View file @
7c9e932f
...
...
@@ -185,6 +185,7 @@ struct OggOpusEnc {
opus_int64
write_granule
;
opus_int64
last_page_granule
;
int
draining
;
int
frame_size_request
;
float
*
lpc_buffer
;
unsigned
char
*
chaining_keyframe
;
int
chaining_keyframe_length
;
...
...
@@ -483,12 +484,13 @@ static void encode_buffer(OggOpusEnc *enc) {
is_keyframe
=
1
;
}
/* Handle the last packet by making sure not to encode too much padding. */
if
(
enc
->
curr_granule
+
enc
->
frame_size
>=
end_granule48k
&&
enc
->
draining
)
{
if
(
enc
->
curr_granule
+
enc
->
frame_size
>=
end_granule48k
&&
enc
->
draining
&&
enc
->
frame_size_request
>
OPUS_FRAMESIZE_20_MS
)
{
int
min_samples
;
int
frame_size_request
=
OPUS_FRAMESIZE_2
_5
_MS
;
int
frame_size_request
=
OPUS_FRAMESIZE_2
0
_MS
;
/* Minimum frame size required for the current frame to still meet the e_o_s condition. */
min_samples
=
end_granule48k
-
enc
->
curr_granule
;
while
(
compute_frame_samples
(
frame_size_request
)
<
min_samples
)
frame_size_request
++
;
assert
(
frame_size_request
<=
enc
->
frame_size_request
);
ope_encoder_ctl
(
enc
,
OPUS_SET_EXPERT_FRAME_DURATION
(
frame_size_request
));
}
packet
=
oggp_get_packet_buffer
(
enc
->
oggp
,
max_packet_size
);
...
...
@@ -830,7 +832,10 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
break
;
}
ret
=
opus_multistream_encoder_ctl
(
enc
->
st
,
request
,
value
);
if
(
ret
==
OPUS_OK
)
enc
->
frame_size
=
compute_frame_samples
(
value
);
if
(
ret
==
OPUS_OK
)
{
enc
->
frame_size
=
compute_frame_samples
(
value
);
enc
->
frame_size_request
=
value
;
}
}
break
;
case
OPUS_GET_APPLICATION_REQUEST
:
...
...
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