Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4620e4c7
Commit
4620e4c7
authored
Nov 02, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/f_loop: make sure duration of frame is never zero
parent
97e9e350
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
f_loop.c
libavfilter/f_loop.c
+12
-3
No files found.
libavfilter/f_loop.c
View file @
4620e4c7
...
...
@@ -267,7 +267,7 @@ static int push_frame(AVFilterContext *ctx)
{
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
LoopContext
*
s
=
ctx
->
priv
;
int64_t
pts
;
int64_t
pts
,
duration
;
int
ret
;
AVFrame
*
out
=
av_frame_clone
(
s
->
frames
[
s
->
current_frame
]);
...
...
@@ -275,7 +275,11 @@ static int push_frame(AVFilterContext *ctx)
if
(
!
out
)
return
AVERROR
(
ENOMEM
);
out
->
pts
+=
s
->
duration
-
s
->
start_pts
;
pts
=
out
->
pts
+
out
->
pkt_duration
;
if
(
out
->
pkt_duration
)
duration
=
out
->
pkt_duration
;
else
duration
=
av_rescale_q
(
1
,
av_inv_q
(
outlink
->
frame_rate
),
outlink
->
time_base
);
pts
=
out
->
pts
+
duration
;
ret
=
ff_filter_frame
(
outlink
,
out
);
s
->
current_frame
++
;
...
...
@@ -295,6 +299,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
LoopContext
*
s
=
ctx
->
priv
;
int64_t
duration
;
int
ret
=
0
;
if
(
inlink
->
frame_count_out
>=
s
->
start
&&
s
->
size
>
0
&&
s
->
loop
!=
0
)
{
...
...
@@ -307,7 +312,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return
AVERROR
(
ENOMEM
);
}
s
->
nb_frames
++
;
s
->
duration
=
frame
->
pts
+
frame
->
pkt_duration
;
if
(
frame
->
pkt_duration
)
duration
=
frame
->
pkt_duration
;
else
duration
=
av_rescale_q
(
1
,
av_inv_q
(
outlink
->
frame_rate
),
outlink
->
time_base
);
s
->
duration
=
frame
->
pts
+
duration
;
ret
=
ff_filter_frame
(
outlink
,
frame
);
}
else
{
av_frame_free
(
&
frame
);
...
...
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