Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
456
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
5a43b773
Commit
5a43b773
authored
11 years ago
by
Ilkka Ollakka
Browse files
Options
Downloads
Patches
Plain Diff
avcodec: check/update buffered_time earlier, so we shouldn't use 0 as time when encoding
Ref #9022
parent
af762f81
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
modules/codec/avcodec/encoder.c
+8
-6
8 additions, 6 deletions
modules/codec/avcodec/encoder.c
with
8 additions
and
6 deletions
modules/codec/avcodec/encoder.c
+
8
−
6
View file @
5a43b773
...
...
@@ -1157,12 +1157,17 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
AVPacket
packet
=
{
0
};
avcodec_get_frame_defaults
(
p_sys
->
frame
);
p_sys
->
frame
->
format
=
p_sys
->
p_context
->
sample_fmt
;
p_sys
->
frame
->
pts
=
date_Get
(
&
p_sys
->
buffer_date
);
p_sys
->
frame
->
nb_samples
=
leftover_samples
+
p_sys
->
i_samples_delay
;
date_Increment
(
&
p_sys
->
buffer_date
,
p_sys
->
i_frame_size
);
if
(
unlikely
(
p_aout_buf
&&
(
p_aout_buf
->
i_pts
>
VLC_TS_INVALID
)
&&
(
p_aout_buf
->
i_pts
!=
date_Get
(
&
p_sys
->
buffer_date
)
)
)
)
date_Set
(
&
p_sys
->
buffer_date
,
p_aout_buf
->
i_pts
);
p_sys
->
frame
->
pts
=
date_Get
(
&
p_sys
->
buffer_date
);
date_Increment
(
&
p_sys
->
buffer_date
,
p_sys
->
i_frame_size
);
if
(
likely
(
p_aout_buf
)
)
{
p_aout_buf
->
i_nb_samples
-=
leftover_samples
;
memcpy
(
p_sys
->
p_buffer
+
buffer_delay
,
p_aout_buf
->
p_buffer
,
leftover
);
...
...
@@ -1177,6 +1182,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
p_aout_buf
->
i_buffer
-=
leftover
;
p_aout_buf
->
i_pts
=
date_Get
(
&
p_sys
->
buffer_date
);
}
if
(
unlikely
(
(
(
leftover
+
buffer_delay
)
<
p_sys
->
i_buffer_out
)
&&
!
(
p_sys
->
p_codec
->
capabilities
&
CODEC_CAP_SMALL_LAST_FRAME
))
)
...
...
@@ -1262,10 +1268,6 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
const
int
align
=
1
;
#endif
if
(
unlikely
(
p_aout_buf
->
i_pts
>
VLC_TS_INVALID
&&
p_aout_buf
->
i_pts
!=
date_Get
(
&
p_sys
->
buffer_date
)
)
)
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
;
...
...
This diff is collapsed.
Click to expand it.
Migration Bot
@MigrationBot
mentioned in issue
#9022 (closed)
·
4 years ago
mentioned in issue
#9022 (closed)
mentioned in issue #9022
Toggle commit list
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