Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
ffworker
Commits
4cbc4560
Commit
4cbc4560
authored
Nov 27, 2017
by
Julian Rother
Browse files
transcode: Ping api at least every 30 seconds
parent
568ea33a
Changes
1
Hide whitespace changes
Inline
Side-by-side
transcode.c
View file @
4cbc4560
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
...
...
@@ -244,6 +245,22 @@ void connect_pads(AVFilterInOut **ins, AVFilterInOut **outs)
}
}
int
checktime
(
time_t
min
)
{
static
struct
timespec
prev
=
{};
time_t
delta
;
struct
timespec
t
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
t
);
if
(
t
.
tv_sec
<
prev
.
tv_sec
)
delta
=
min
;
else
delta
=
t
.
tv_sec
-
prev
.
tv_sec
;
if
(
delta
<
min
)
return
1
;
memcpy
(
&
prev
,
&
t
,
sizeof
(
prev
));
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
err
,
i
,
progress
,
_progress
;
...
...
@@ -327,7 +344,7 @@ int main(int argc, char *argv[])
{
i
=
pkt
.
stream_index
;
_progress
=
av_rescale_q
(
pkt
.
pts
,
demux
->
streams
[
i
]
->
time_base
,
AV_TIME_BASE_Q
)
*
100
/
demux
->
duration
;
if
(
_progress
>
progress
)
if
(
_progress
>
progress
||
!
checktime
(
30
)
)
{
ping_job
(
jobid
,
"running"
,
"{
\"
progress
\"
: %i,
\"
log
\"
:
\"
%s
\"
}"
,
_progress
,
jescape
(
get_avlogbuf
()));
...
...
Write
Preview
Supports
Markdown
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