| 1649 | } |
| 1650 | |
| 1651 | static int read_data_continuous(void *opaque, uint8_t *buf, int buf_size) |
| 1652 | { |
| 1653 | struct playlist *v = opaque; |
| 1654 | HLSContext *c = v->parent->priv_data; |
| 1655 | int ret; |
| 1656 | int just_opened = 0; |
| 1657 | int segment_retries = 0; |
| 1658 | struct segment *seg; |
| 1659 | |
| 1660 | if (c->http_persistent && v->input_read_done) { |
| 1661 | ret = reload_playlist(v, c); |
| 1662 | if (ret < 0) |
| 1663 | return ret; |
| 1664 | } |
| 1665 | |
| 1666 | v->input_read_done = 0; |
| 1667 | |
| 1668 | restart: |
| 1669 | ret = reload_playlist(v, c); |
| 1670 | if (ret < 0) |
| 1671 | return ret; |
| 1672 | |
| 1673 | seg = current_segment(v); |
| 1674 | |
| 1675 | if (!v->input || (c->http_persistent && v->input_read_done)) { |
| 1676 | /* load/update Media Initialization Section, if any */ |
| 1677 | ret = update_init_section(v, seg); |
| 1678 | if (ret) |
| 1679 | return ret; |
| 1680 | |
| 1681 | if (c->http_multiple == 1 && v->input_next_requested) { |
| 1682 | FFSWAP(AVIOContext *, v->input, v->input_next); |
| 1683 | v->cur_seg_offset = 0; |
| 1684 | v->input_next_requested = 0; |
| 1685 | ret = 0; |
| 1686 | } else { |
| 1687 | ret = open_input(c, v, seg, &v->input); |
| 1688 | } |
| 1689 | if (ret < 0) { |
| 1690 | if (ff_check_interrupt(c->interrupt_callback)) |
| 1691 | return AVERROR_EXIT; |
| 1692 | av_log(v->parent, AV_LOG_WARNING, "Failed to open segment %"PRId64" of playlist %d\n", |
| 1693 | v->cur_seq_no, |
| 1694 | v->index); |
| 1695 | if (segment_retries >= c->seg_max_retry) { |
| 1696 | av_log(v->parent, AV_LOG_WARNING, "Segment %"PRId64" of playlist %d failed too many times, skipping\n", |
| 1697 | v->cur_seq_no, |
| 1698 | v->index); |
| 1699 | v->cur_seq_no++; |
| 1700 | segment_retries = 0; |
| 1701 | } else { |
| 1702 | segment_retries++; |
| 1703 | } |
| 1704 | goto restart; |
| 1705 | } |
| 1706 | segment_retries = 0; |
| 1707 | just_opened = 1; |
| 1708 | } |
nothing calls this directly
no test coverage detected