| 560 | } |
| 561 | |
| 562 | static int receive_internal(SyncQueue *sq, int stream_idx, SyncQueueFrame frame) |
| 563 | { |
| 564 | int nb_eof = 0; |
| 565 | int ret; |
| 566 | |
| 567 | /* read a frame for a specific stream */ |
| 568 | if (stream_idx >= 0) { |
| 569 | ret = receive_for_stream(sq, stream_idx, frame); |
| 570 | return (ret < 0) ? ret : stream_idx; |
| 571 | } |
| 572 | |
| 573 | /* read a frame for any stream with available output */ |
| 574 | for (unsigned int i = 0; i < sq->nb_streams; i++) { |
| 575 | ret = receive_for_stream(sq, i, frame); |
| 576 | if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) { |
| 577 | nb_eof += (ret == AVERROR_EOF); |
| 578 | continue; |
| 579 | } |
| 580 | return (ret < 0) ? ret : i; |
| 581 | } |
| 582 | |
| 583 | return (nb_eof == sq->nb_streams) ? AVERROR_EOF : AVERROR(EAGAIN); |
| 584 | } |
| 585 | |
| 586 | int sq_receive(SyncQueue *sq, int stream_idx, SyncQueueFrame frame) |
| 587 | { |
no test coverage detected