Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
71fa82be
Commit
71fa82be
authored
Apr 21, 2018
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavu/threadmessage: add av_thread_message_queue_nb_elems()
parent
02e4970b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
2 deletions
+28
-2
APIchanges
doc/APIchanges
+3
-0
threadmessage.c
libavutil/threadmessage.c
+13
-0
threadmessage.h
libavutil/threadmessage.h
+8
-0
version.h
libavutil/version.h
+1
-1
api-threadmessage-test.c
tests/api/api-threadmessage-test.c
+3
-1
No files found.
doc/APIchanges
View file @
71fa82be
...
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
...
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
API changes, most recent first:
2018-04-xx - xxxxxxxxxx - lavu 56.16.100 - threadmessage.h
Add av_thread_message_queue_nb_elems().
-------- 8< --------- FFmpeg 4.0 was cut here -------- 8< ---------
-------- 8< --------- FFmpeg 4.0 was cut here -------- 8< ---------
2018-04-03 - d6fc031caf - lavu 56.13.100 - pixdesc.h
2018-04-03 - d6fc031caf - lavu 56.13.100 - pixdesc.h
...
...
libavutil/threadmessage.c
View file @
71fa82be
...
@@ -102,6 +102,19 @@ void av_thread_message_queue_free(AVThreadMessageQueue **mq)
...
@@ -102,6 +102,19 @@ void av_thread_message_queue_free(AVThreadMessageQueue **mq)
#endif
#endif
}
}
int
av_thread_message_queue_nb_elems
(
AVThreadMessageQueue
*
mq
)
{
#if HAVE_THREADS
int
ret
;
pthread_mutex_lock
(
&
mq
->
lock
);
ret
=
av_fifo_size
(
mq
->
fifo
);
pthread_mutex_unlock
(
&
mq
->
lock
);
return
ret
/
mq
->
elsize
;
#else
return
AVERROR
(
ENOSYS
);
#endif
}
#if HAVE_THREADS
#if HAVE_THREADS
static
int
av_thread_message_queue_send_locked
(
AVThreadMessageQueue
*
mq
,
static
int
av_thread_message_queue_send_locked
(
AVThreadMessageQueue
*
mq
,
...
...
libavutil/threadmessage.h
View file @
71fa82be
...
@@ -95,6 +95,14 @@ void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
...
@@ -95,6 +95,14 @@ void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
void
av_thread_message_queue_set_free_func
(
AVThreadMessageQueue
*
mq
,
void
av_thread_message_queue_set_free_func
(
AVThreadMessageQueue
*
mq
,
void
(
*
free_func
)(
void
*
msg
));
void
(
*
free_func
)(
void
*
msg
));
/**
* Return the current number of messages in the queue.
*
* @return the current number of messages or AVERROR(ENOSYS) if lavu was built
* without thread support
*/
int
av_thread_message_queue_nb_elems
(
AVThreadMessageQueue
*
mq
);
/**
/**
* Flush the message queue
* Flush the message queue
*
*
...
...
libavutil/version.h
View file @
71fa82be
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
*/
*/
#define LIBAVUTIL_VERSION_MAJOR 56
#define LIBAVUTIL_VERSION_MAJOR 56
#define LIBAVUTIL_VERSION_MINOR 1
5
#define LIBAVUTIL_VERSION_MINOR 1
6
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
tests/api/api-threadmessage-test.c
View file @
71fa82be
...
@@ -130,7 +130,9 @@ static void *receiver_thread(void *arg)
...
@@ -130,7 +130,9 @@ static void *receiver_thread(void *arg)
for
(
i
=
0
;
i
<
rd
->
workload
;
i
++
)
{
for
(
i
=
0
;
i
<
rd
->
workload
;
i
++
)
{
if
(
rand
()
%
rd
->
workload
<
rd
->
workload
/
10
)
{
if
(
rand
()
%
rd
->
workload
<
rd
->
workload
/
10
)
{
av_log
(
NULL
,
AV_LOG_INFO
,
"receiver #%d: flushing the queue
\n
"
,
rd
->
id
);
av_log
(
NULL
,
AV_LOG_INFO
,
"receiver #%d: flushing the queue, "
"discarding %d message(s)
\n
"
,
rd
->
id
,
av_thread_message_queue_nb_elems
(
rd
->
queue
));
av_thread_message_flush
(
rd
->
queue
);
av_thread_message_flush
(
rd
->
queue
);
}
else
{
}
else
{
struct
message
msg
;
struct
message
msg
;
...
...
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