| 370 | } |
| 371 | |
| 372 | static int queue_alloc(ThreadQueue **ptq, unsigned nb_streams, unsigned queue_size, |
| 373 | enum QueueType type) |
| 374 | { |
| 375 | ThreadQueue *tq; |
| 376 | |
| 377 | if (queue_size <= 0) { |
| 378 | if (type == QUEUE_FRAMES) |
| 379 | queue_size = DEFAULT_FRAME_THREAD_QUEUE_SIZE; |
| 380 | else |
| 381 | queue_size = DEFAULT_PACKET_THREAD_QUEUE_SIZE; |
| 382 | } |
| 383 | |
| 384 | if (type == QUEUE_FRAMES) { |
| 385 | // This queue length is used in the decoder code to ensure that |
| 386 | // there are enough entries in fixed-size frame pools to account |
| 387 | // for frames held in queues inside the ffmpeg utility. If this |
| 388 | // can ever dynamically change then the corresponding decode |
| 389 | // code needs to be updated as well. |
| 390 | av_assert0(queue_size <= DEFAULT_FRAME_THREAD_QUEUE_SIZE); |
| 391 | } |
| 392 | |
| 393 | tq = tq_alloc(nb_streams, queue_size, |
| 394 | (type == QUEUE_PACKETS) ? THREAD_QUEUE_PACKETS : THREAD_QUEUE_FRAMES); |
| 395 | if (!tq) |
| 396 | return AVERROR(ENOMEM); |
| 397 | |
| 398 | *ptq = tq; |
| 399 | return 0; |
| 400 | } |
| 401 | |
| 402 | static void *task_wrapper(void *arg); |
| 403 |
no test coverage detected