| 105 | } |
| 106 | |
| 107 | static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size) |
| 108 | { |
| 109 | ThreadContext *c= avctx->thread_opaque; |
| 110 | int dummy_ret; |
| 111 | |
| 112 | if (job_count <= 0) |
| 113 | return 0; |
| 114 | |
| 115 | pthread_mutex_lock(&c->current_job_lock); |
| 116 | |
| 117 | c->current_job = avctx->thread_count; |
| 118 | c->job_count = job_count; |
| 119 | c->job_size = job_size; |
| 120 | c->args = arg; |
| 121 | c->func = func; |
| 122 | if (ret) { |
| 123 | c->rets = ret; |
| 124 | c->rets_count = job_count; |
| 125 | } else { |
| 126 | c->rets = &dummy_ret; |
| 127 | c->rets_count = 1; |
| 128 | } |
| 129 | pthread_cond_broadcast(&c->current_job_cond); |
| 130 | |
| 131 | avcodec_thread_park_workers(c, avctx->thread_count); |
| 132 | |
| 133 | return 0; |
| 134 | } |
| 135 | |
| 136 | static int avcodec_thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count) |
| 137 | { |
no test coverage detected