Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-2-2
Commits
6d714365
Commit
6d714365
authored
Apr 01, 2013
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: check if we can feed variable size frames to audio encoder
parent
8fc2c5f5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+10
-2
No files found.
modules/codec/avcodec/encoder.c
View file @
6d714365
...
...
@@ -118,6 +118,7 @@ struct encoder_sys_t
size_t
i_frame_size
;
size_t
i_samples_delay
;
//How much samples in delay buffer
bool
b_planar
;
bool
b_variable
;
//Encoder can be fed with any size frames not just frame_size
mtime_t
i_pts
;
date_t
buffer_date
;
...
...
@@ -862,6 +863,8 @@ int OpenEncoder( vlc_object_t *p_this )
}
p_enc
->
fmt_out
.
audio
.
i_blockalign
=
p_context
->
block_align
;
p_enc
->
fmt_out
.
audio
.
i_bitspersample
=
aout_BitsPerSample
(
p_enc
->
fmt_out
.
i_codec
);
//b_variable tells if we can feed any size frames to encoder
p_sys
->
b_variable
=
p_context
->
frame_size
?
false
:
true
;
p_sys
->
i_buffer_out
=
p_sys
->
i_frame_size
*
p_sys
->
i_sample_bytes
*
p_enc
->
fmt_in
.
audio
.
i_channels
;
}
...
...
@@ -1205,7 +1208,9 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
return
p_chain
;
}
while
(
i_samples_left
>=
p_sys
->
i_frame_size
)
while
(
(
p_aout_buf
->
i_nb_samples
>=
p_sys
->
i_frame_size
)
||
(
p_sys
->
b_variable
&&
p_aout_buf
->
i_nb_samples
)
)
{
AVPacket
packet
=
{
0
};
...
...
@@ -1214,6 +1219,9 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
date_Set
(
&
p_sys
->
buffer_date
,
p_aout_buf
->
i_pts
);
avcodec_get_frame_defaults
(
p_sys
->
frame
);
if
(
p_sys
->
b_variable
)
p_sys
->
frame
->
nb_samples
=
p_aout_buf
->
i_nb_samples
;
else
p_sys
->
frame
->
nb_samples
=
p_sys
->
i_frame_size
;
p_sys
->
frame
->
format
=
p_sys
->
p_context
->
sample_fmt
;
p_sys
->
frame
->
pts
=
date_Get
(
&
p_sys
->
buffer_date
);
...
...
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