FFmpeg
Loading...
Searching...
No Matches
api-threadmessage-test.c File Reference

Go to the source code of this file.

Data Structures

struct  sender_data
 Thread message API test. More...
 
struct  receiver_data
 
struct  message
 

Macros

#define MAGIC   0xdeadc0de
 
#define SPAWN_THREADS(type)
 
#define WAIT_THREADS(type)
 

Functions

static void free_frame (void *arg)
 
static void * sender_thread (void *arg)
 
static void * receiver_thread (void *arg)
 
static int get_workload (int minv, int maxv)
 
int main (int ac, char **av)
 

Macro Definition Documentation

◆ MAGIC

#define MAGIC   0xdeadc0de

Definition at line 54 of file api-threadmessage-test.c.

◆ SPAWN_THREADS

#define SPAWN_THREADS ( type)
Value:
do { \
for (i = 0; i < nb_##type##s; i++) { \
struct type##_data *td = &type##s[i]; \
\
td->id = i; \
td->queue = queue; \
td->workload = get_workload(type##_min_load, type##_max_load); \
\
ret = pthread_create(&td->tid, NULL, type##_thread, td); \
if (ret) { \
const int err = AVERROR(ret); \
av_log(NULL, AV_LOG_ERROR, "Unable to start " AV_STRINGIFY(type) \
" thread: %s\n", av_err2str(err)); \
goto end; \
} \
} \
} while (0)
static int get_workload(int minv, int maxv)
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define NULL
Definition coverity.c:32
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition error.h:122
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
#define AV_STRINGIFY(s)
Definition macros.h:66
cl_device_type type
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition os2threads.h:80

Referenced by main().

◆ WAIT_THREADS

#define WAIT_THREADS ( type)
Value:
do { \
for (i = 0; i < nb_##type##s; i++) { \
struct type##_data *td = &type##s[i]; \
\
ret = pthread_join(td->tid, NULL); \
if (ret) { \
const int err = AVERROR(ret); \
av_log(NULL, AV_LOG_ERROR, "Unable to join " AV_STRINGIFY(type) \
" thread: %s\n", av_err2str(err)); \
goto end; \
} \
} \
} while (0)
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition os2threads.h:94

Referenced by main().

Function Documentation

◆ free_frame()

static void free_frame ( void * arg)
static

Definition at line 56 of file api-threadmessage-test.c.

◆ sender_thread()

static void * sender_thread ( void * arg)
static

Definition at line 63 of file api-threadmessage-test.c.

◆ receiver_thread()

static void * receiver_thread ( void * arg)
static

Definition at line 127 of file api-threadmessage-test.c.

◆ get_workload()

static int get_workload ( int minv,
int maxv )
static

Definition at line 160 of file api-threadmessage-test.c.

◆ main()

int main ( int ac,
char ** av )

Definition at line 165 of file api-threadmessage-test.c.