| 4022 | } |
| 4023 | |
| 4024 | static int init_input_threads(void) |
| 4025 | { |
| 4026 | int i, ret; |
| 4027 | |
| 4028 | if (nb_input_files == 1) |
| 4029 | return 0; |
| 4030 | |
| 4031 | for (i = 0; i < nb_input_files; i++) { |
| 4032 | InputFile *f = input_files[i]; |
| 4033 | |
| 4034 | if (f->ctx->pb ? !f->ctx->pb->seekable : |
| 4035 | strcmp(f->ctx->iformat->name, "lavfi")) |
| 4036 | f->non_blocking = 1; |
| 4037 | ret = av_thread_message_queue_alloc(&f->in_thread_queue, |
| 4038 | f->thread_queue_size, sizeof(AVPacket)); |
| 4039 | if (ret < 0) |
| 4040 | return ret; |
| 4041 | |
| 4042 | if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) { |
| 4043 | av_log(NULL, AV_LOG_ERROR, "pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret)); |
| 4044 | av_thread_message_queue_free(&f->in_thread_queue); |
| 4045 | return AVERROR(ret); |
| 4046 | } |
| 4047 | } |
| 4048 | return 0; |
| 4049 | } |
| 4050 | |
| 4051 | static int get_input_packet_mt(InputFile *f, AVPacket *pkt) |
| 4052 | { |