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

stream_filter/httplive.c: #EXTINF: accepts integer (version < 3) or floating...

stream_filter/httplive.c: #EXTINF: accepts integer (version < 3) or floating points based on protocol version.

Update logic in parse_SegmentationInformation() to accept float values
for duration as mentioned in later version of the draft specification.
parent 33489c92
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#endif #endif
#include <limits.h> #include <limits.h>
#include <errno.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
...@@ -515,7 +516,30 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati ...@@ -515,7 +516,30 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati
if (token == NULL) if (token == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
*duration = atoi(token); int value;
if (hls->version < 3)
{
value = strtol(token, NULL, 10);
if (errno == ERANGE)
{
*duration = -1;
return VLC_EGENERIC;
}
*duration = value;
}
else
{
double d = strtod(token, (char **) NULL);
if (errno == ERANGE)
{
*duration = -1;
return VLC_EGENERIC;
}
if ((d) - ((int)d) >= 0.5)
value = ((int)d) + 1;
else
value = ((int)d);
}
/* Ignore the rest of the line */ /* Ignore the rest of the line */
......
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