Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
f1626602
Commit
f1626602
authored
Apr 22, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: httplive: use stream size for m3u8
parent
af698180
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
27 deletions
+28
-27
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+28
-27
No files found.
modules/stream_filter/httplive.c
View file @
f1626602
...
@@ -1915,47 +1915,48 @@ end:
...
@@ -1915,47 +1915,48 @@ end:
/* Read M3U8 file */
/* Read M3U8 file */
static
ssize_t
read_M3U8_from_stream
(
stream_t
*
s
,
uint8_t
**
buffer
)
static
ssize_t
read_M3U8_from_stream
(
stream_t
*
s
,
uint8_t
**
buffer
)
{
{
int64_t
total_bytes
=
0
;
int64_t
total_allocated
=
0
;
uint8_t
*
p
=
NULL
;
uint8_t
*
p
=
NULL
;
int64_t
size
=
stream_Size
(
s
);
size
=
VLC_CLIP
(
size
,
0
,
INT64_MAX
-
1
);
int64_t
i_alloc_size
=
0
;
ssize_t
i_total_read
=
0
;
unsigned
i_chunk_size
=
HLS_READ_SIZE
;
while
(
1
)
for
(
;;
)
{
int
i_toread
=
(
size
)
?
size
-
i_total_read
:
i_chunk_size
;
if
(
i_toread
+
i_total_read
>
INT64_MAX
-
1
)
break
;
if
(
i_alloc_size
<
i_toread
)
{
{
char
buf
[
4096
];
i_alloc_size
+=
i_toread
;
int64_t
bytes
;
p
=
realloc_or_free
(
p
,
1
+
i_alloc_size
);
if
(
p
==
NULL
)
return
VLC_ENOMEM
;
if
(
i_chunk_size
<
(
1
<<
26
))
i_chunk_size
<<=
1
;
}
bytes
=
stream_Read
(
s
,
buf
,
sizeof
(
buf
));
int
i_read
=
stream_Read
(
s
,
&
p
[
i_total_read
],
i_toread
);
if
(
bytes
==
0
)
if
(
i_read
==
0
)
{
break
;
/* EOF ? */
break
;
/* EOF ? */
else
if
(
bytes
<
0
)
}
else
if
(
i_read
<
0
)
{
{
free
(
p
);
free
(
p
);
return
bytes
;
return
i_read
;
}
}
if
(
(
total_bytes
+
bytes
+
1
)
>
total_allocated
)
{
if
(
total_allocated
)
total_allocated
*=
2
;
else
else
total_allocated
=
__MIN
((
uint64_t
)
bytes
+
1
,
sizeof
(
buf
));
{
i_total_read
+=
i_read
;
p
=
realloc_or_free
(
p
,
total_allocated
);
if
(
p
==
NULL
)
return
VLC_ENOMEM
;
}
}
memcpy
(
p
+
total_bytes
,
buf
,
bytes
);
total_bytes
+=
bytes
;
}
}
if
(
total_allocated
==
0
)
p
[
i_total_read
]
=
'\0'
;
return
VLC_EGENERIC
;
p
[
total_bytes
]
=
'\0'
;
*
buffer
=
p
;
*
buffer
=
p
;
return
total_bytes
;
return
i_total_read
;
}
}
static
ssize_t
read_M3U8_from_url
(
stream_t
*
s
,
const
char
*
psz_url
,
uint8_t
**
buffer
)
static
ssize_t
read_M3U8_from_url
(
stream_t
*
s
,
const
char
*
psz_url
,
uint8_t
**
buffer
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment