Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
845bb401
Commit
845bb401
authored
Dec 05, 2016
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: move chunk handling from http_read_stream() to http_buf_read().
parent
2a05c8f8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
http.c
libavformat/http.c
+31
-26
No files found.
libavformat/http.c
View file @
845bb401
...
@@ -1168,6 +1168,34 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
...
@@ -1168,6 +1168,34 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
{
{
HTTPContext
*
s
=
h
->
priv_data
;
HTTPContext
*
s
=
h
->
priv_data
;
int
len
;
int
len
;
if
(
s
->
chunksize
!=
UINT64_MAX
)
{
if
(
!
s
->
chunksize
)
{
char
line
[
32
];
int
err
;
do
{
if
((
err
=
http_get_line
(
s
,
line
,
sizeof
(
line
)))
<
0
)
return
err
;
}
while
(
!*
line
);
/* skip CR LF from last chunk */
s
->
chunksize
=
strtoull
(
line
,
NULL
,
16
);
av_log
(
h
,
AV_LOG_TRACE
,
"Chunked encoding data size: %"
PRIu64
"'
\n
"
,
s
->
chunksize
);
if
(
!
s
->
chunksize
)
return
0
;
else
if
(
s
->
chunksize
==
UINT64_MAX
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Invalid chunk size %"
PRIu64
"
\n
"
,
s
->
chunksize
);
return
AVERROR
(
EINVAL
);
}
}
size
=
FFMIN
(
size
,
s
->
chunksize
);
}
/* read bytes from input buffer first */
/* read bytes from input buffer first */
len
=
s
->
buf_end
-
s
->
buf_ptr
;
len
=
s
->
buf_end
-
s
->
buf_ptr
;
if
(
len
>
0
)
{
if
(
len
>
0
)
{
...
@@ -1190,9 +1218,11 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
...
@@ -1190,9 +1218,11 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
}
}
if
(
len
>
0
)
{
if
(
len
>
0
)
{
s
->
off
+=
len
;
s
->
off
+=
len
;
if
(
s
->
chunksize
>
0
)
if
(
s
->
chunksize
>
0
)
{
av_assert0
(
s
->
chunksize
>=
len
);
s
->
chunksize
-=
len
;
s
->
chunksize
-=
len
;
}
}
}
return
len
;
return
len
;
}
}
...
@@ -1246,31 +1276,6 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size)
...
@@ -1246,31 +1276,6 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size)
return
err
;
return
err
;
}
}
if
(
s
->
chunksize
!=
UINT64_MAX
)
{
if
(
!
s
->
chunksize
)
{
char
line
[
32
];
do
{
if
((
err
=
http_get_line
(
s
,
line
,
sizeof
(
line
)))
<
0
)
return
err
;
}
while
(
!*
line
);
/* skip CR LF from last chunk */
s
->
chunksize
=
strtoull
(
line
,
NULL
,
16
);
av_log
(
h
,
AV_LOG_TRACE
,
"Chunked encoding data size: %"
PRIu64
"'
\n
"
,
s
->
chunksize
);
if
(
!
s
->
chunksize
)
return
0
;
else
if
(
s
->
chunksize
==
UINT64_MAX
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Invalid chunk size %"
PRIu64
"
\n
"
,
s
->
chunksize
);
return
AVERROR
(
EINVAL
);
}
}
size
=
FFMIN
(
size
,
s
->
chunksize
);
}
#if CONFIG_ZLIB
#if CONFIG_ZLIB
if
(
s
->
compressed
)
if
(
s
->
compressed
)
return
http_buf_read_compressed
(
h
,
buf
,
size
);
return
http_buf_read_compressed
(
h
,
buf
,
size
);
...
...
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