[vlc-commits] httplive: small simplification
Ilkka Ollakka
git at videolan.org
Mon Oct 14 22:10:54 CEST 2013
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Aug 26 18:51:50 2013 +0300| [a5c4d7afee8361ccfe7e29c4885a3e291a006c8d] | committer: Ilkka Ollakka
httplive: small simplification
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a5c4d7afee8361ccfe7e29c4885a3e291a006c8d
---
modules/stream_filter/httplive.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index ef14b80..9f965cb 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -449,8 +449,9 @@ static int ChooseSegment(stream_t *s, const int current)
int duration = 0;
int sequence = 0;
int count = vlc_array_count(hls->segments);
- int i = p_sys->b_live ? count - 1 : 0;
+ int i = p_sys->b_live ? count - 1 : -1;
+ /* We do while loop only with live case, otherwise return 0*/
while((i >= 0) && (i < count))
{
segment_t *segment = segment_GetSegment(hls, i);
@@ -466,15 +467,12 @@ static int ChooseSegment(stream_t *s, const int current)
if (duration >= 3 * hls->duration)
{
/* Start point found */
- wanted = p_sys->b_live ? i : 0;
+ wanted = i;
sequence = segment->sequence;
break;
}
- if (p_sys->b_live)
- i-- ;
- else
- i++;
+ i-- ;
}
msg_Dbg(s, "Choose segment %d/%d (sequence=%d)", wanted, count, sequence);
@@ -748,7 +746,7 @@ static int parse_MediaSequence(stream_t *s, hls_stream_t *hls, char *p_read)
if ( ( last_segment->sequence < sequence) &&
( sequence - last_segment->sequence >= 1 ))
msg_Err(s, "EXT-X-MEDIA-SEQUENCE gap in playlist (new=%d, old=%d)",
- sequence, last->sequence);
+ sequence, last_segment->sequence);
}
else
msg_Err(s, "EXT-X-MEDIA-SEQUENCE already present in playlist (new=%d, old=%d)",
More information about the vlc-commits
mailing list