MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / read_data_continuous

Function read_data_continuous

libavformat/hls.c:1651–1764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1649}
1650
1651static 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
1668restart:
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 }

Callers

nothing calls this directly

Calls 13

reload_playlistFunction · 0.85
current_segmentFunction · 0.85
ff_check_interruptFunction · 0.85
av_logFunction · 0.85
av_opt_getFunction · 0.85
av_freepFunction · 0.85
next_segmentFunction · 0.85
av_strstartFunction · 0.85
intercept_id3Function · 0.85
ff_format_io_closeFunction · 0.85
update_init_sectionFunction · 0.70
open_inputFunction · 0.70

Tested by

no test coverage detected