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
b48ee570
Commit
b48ee570
authored
Nov 14, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLS: Do not assume Content-Length is set
Fixes #8078
parent
701fc0c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
11 deletions
+38
-11
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+38
-11
No files found.
modules/stream_filter/httplive.c
View file @
b48ee570
...
...
@@ -1838,43 +1838,66 @@ static int hls_Download(stream_t *s, segment_t *segment)
return
VLC_EGENERIC
;
segment
->
size
=
stream_Size
(
p_ts
);
assert
(
segment
->
size
>
0
);
segment
->
data
=
block_Alloc
(
segment
->
size
);
if
(
segment
->
data
==
NULL
)
{
if
(
segment
->
size
==
0
)
{
int
chunk_size
=
65536
;
segment
->
data
=
block_Alloc
(
chunk_size
);
if
(
!
segment
->
data
)
goto
nomem
;
do
{
if
(
segment
->
data
->
i_buffer
-
segment
->
size
<
chunk_size
)
{
chunk_size
*=
2
;
block_t
*
p_block
=
block_Realloc
(
segment
->
data
,
0
,
segment
->
data
->
i_buffer
+
chunk_size
);
if
(
!
p_block
)
{
block_Release
(
segment
->
data
);
segment
->
data
=
NULL
;
goto
nomem
;
}
segment
->
data
=
p_block
;
}
ssize_t
length
=
stream_Read
(
p_ts
,
segment
->
data
->
p_buffer
+
segment
->
size
,
chunk_size
);
if
(
length
<=
0
)
{
segment
->
data
->
i_buffer
=
segment
->
size
;
break
;
}
segment
->
size
+=
length
;
}
while
(
vlc_object_alive
(
s
));
stream_Delete
(
p_ts
);
return
VLC_
ENOMEM
;
return
VLC_
SUCCESS
;
}
segment
->
data
=
block_Alloc
(
segment
->
size
);
if
(
segment
->
data
==
NULL
)
goto
nomem
;
assert
(
segment
->
data
->
i_buffer
==
segment
->
size
);
ssize_t
length
=
0
,
curlen
=
0
;
uint64_t
size
;
ssize_t
curlen
=
0
;
do
{
/* NOTE: Beware the size reported for a segment by the HLS server may not
* be correct, when downloading the segment data. Therefore check the size
* and enlarge the segment data block if necessary.
*/
size
=
stream_Size
(
p_ts
);
uint64_t
size
=
stream_Size
(
p_ts
);
if
(
size
>
segment
->
size
)
{
msg_Dbg
(
s
,
"size changed %"
PRIu64
,
segment
->
size
);
block_t
*
p_block
=
block_Realloc
(
segment
->
data
,
0
,
size
);
if
(
p_block
==
NULL
)
{
stream_Delete
(
p_ts
);
block_Release
(
segment
->
data
);
segment
->
data
=
NULL
;
return
VLC_ENOMEM
;
goto
nomem
;
}
segment
->
data
=
p_block
;
segment
->
size
=
size
;
assert
(
segment
->
data
->
i_buffer
==
segment
->
size
);
p_block
=
NULL
;
}
length
=
stream_Read
(
p_ts
,
segment
->
data
->
p_buffer
+
curlen
,
segment
->
size
-
curlen
);
ssize_t
length
=
stream_Read
(
p_ts
,
segment
->
data
->
p_buffer
+
curlen
,
segment
->
size
-
curlen
);
if
(
length
<=
0
)
break
;
curlen
+=
length
;
...
...
@@ -1882,6 +1905,10 @@ static int hls_Download(stream_t *s, segment_t *segment)
stream_Delete
(
p_ts
);
return
VLC_SUCCESS
;
nomem:
stream_Delete
(
p_ts
);
return
VLC_ENOMEM
;
}
/* Read M3U8 file */
...
...
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