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
0a065694
Commit
0a065694
authored
Jun 09, 2016
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/udp: do not accumulate packet_gap delay errors
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
8b7b52c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
udp.c
libavformat/udp.c
+13
-2
No files found.
libavformat/udp.c
View file @
0a065694
...
...
@@ -552,6 +552,7 @@ static void *circular_buffer_task_tx( void *_URLContext)
URLContext
*
h
=
_URLContext
;
UDPContext
*
s
=
h
->
priv_data
;
int
old_cancelstate
;
int64_t
target_timestamp
=
0
;
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
old_cancelstate
);
pthread_mutex_lock
(
&
s
->
mutex
);
...
...
@@ -566,6 +567,7 @@ static void *circular_buffer_task_tx( void *_URLContext)
int
len
;
const
uint8_t
*
p
;
uint8_t
tmp
[
4
];
int64_t
timestamp
;
len
=
av_fifo_size
(
s
->
fifo
);
...
...
@@ -589,6 +591,17 @@ static void *circular_buffer_task_tx( void *_URLContext)
pthread_mutex_unlock
(
&
s
->
mutex
);
pthread_setcancelstate
(
PTHREAD_CANCEL_ENABLE
,
&
old_cancelstate
);
if
(
s
->
packet_gap
)
{
timestamp
=
av_gettime_relative
();
if
(
timestamp
<
target_timestamp
)
{
target_timestamp
=
FFMIN
(
target_timestamp
,
timestamp
+
s
->
packet_gap
);
av_usleep
(
target_timestamp
-
timestamp
);
}
else
{
target_timestamp
=
timestamp
;
}
target_timestamp
+=
s
->
packet_gap
;
}
p
=
s
->
tmp
;
while
(
len
)
{
int
ret
;
...
...
@@ -613,8 +626,6 @@ static void *circular_buffer_task_tx( void *_URLContext)
}
}
av_usleep
(
s
->
packet_gap
);
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
old_cancelstate
);
pthread_mutex_lock
(
&
s
->
mutex
);
}
...
...
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