Commit da2b1252 authored by Jean-Paul Saman's avatar Jean-Paul Saman

stream_filter/httplive.c: Better length calculation (WIP)

Use segment duration mtime_t
parent 3f586729
...@@ -61,7 +61,7 @@ vlc_module_end() ...@@ -61,7 +61,7 @@ vlc_module_end()
typedef struct segment_s typedef struct segment_s
{ {
int sequence; /* unique sequence number */ int sequence; /* unique sequence number */
int length; /* segment duration (ms) */ mtime_t length; /* segment duration (ms) */
uint64_t size; /* segment size in bytes */ uint64_t size; /* segment size in bytes */
vlc_url_t url; vlc_url_t url;
...@@ -241,7 +241,7 @@ static segment_t *segment_New(hls_stream_t* hls, int duration, char *uri) ...@@ -241,7 +241,7 @@ static segment_t *segment_New(hls_stream_t* hls, int duration, char *uri)
if (segment == NULL) if (segment == NULL)
return NULL; return NULL;
segment->length = duration; /* seconds */ segment->length = duration * INT64_C(1000000);
segment->size = 0; /* bytes */ segment->size = 0; /* bytes */
segment->sequence = 0; segment->sequence = 0;
vlc_UrlParse(&segment->url, uri, 0); vlc_UrlParse(&segment->url, uri, 0);
...@@ -776,7 +776,7 @@ static int parse_HTTPLiveStreaming(stream_t *s) ...@@ -776,7 +776,7 @@ static int parse_HTTPLiveStreaming(stream_t *s)
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
segment_t *segment = segment_GetSegment(hls, i); segment_t *segment = segment_GetSegment(hls, i);
if (segment && segment->length >= hls->duration) if (segment && segment->length >= (hls->duration * INT64_C(1000000)))
ok++; ok++;
} }
if (ok < 3) if (ok < 3)
...@@ -924,7 +924,7 @@ static int Prefetch(stream_t *s, int *current) ...@@ -924,7 +924,7 @@ static int Prefetch(stream_t *s, int *current)
{ {
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
hls_stream_t *hls = hls_Get(p_sys->hls_stream, current); hls_stream_t *hls = hls_Get(p_sys->hls_stream, *current);
if (hls == NULL) if (hls == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment