[vlc-commits] Fix trying to prefetch 2 segments from a 1-segment HLS stream
Chris Smowton
git at videolan.org
Thu May 31 17:18:40 CEST 2012
vlc/vlc-2.0 | branch: master | Chris Smowton <cs448 at cam.ac.uk> | Wed May 30 14:30:04 2012 +0100| [0879b3f6a769d1a13f96d83c3cbff4d10952c8cb] | committer: Jean-Baptiste Kempf
Fix trying to prefetch 2 segments from a 1-segment HLS stream
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 7e21f34f1cf7fd9f3c9d73b5b39d7c671101d22c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=0879b3f6a769d1a13f96d83c3cbff4d10952c8cb
---
modules/stream_filter/httplive.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 58229bd..c2daad2 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1652,8 +1652,13 @@ static int Prefetch(stream_t *s, int *current)
if (hls == NULL)
return VLC_EGENERIC;
- /* Download first 2 segments of this HLS stream */
- for (int i = 0; i < 2; i++)
+ if (vlc_array_count(hls->segments) == 0)
+ return VLC_EGENERIC;
+ else if (vlc_array_count(hls->segments) == 1 && p_sys->b_live)
+ msg_Warn(s, "Only 1 segment available to prefetch in live stream; may stall");
+
+ /* Download first 2 segments of this HLS stream if they exist */
+ for (int i = 0; i < __MIN(vlc_array_count(hls->segments), 2); i++)
{
segment_t *segment = segment_GetSegment(hls, p_sys->download.segment);
if (segment == NULL )
More information about the vlc-commits
mailing list