Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
29121188
Commit
29121188
authored
May 02, 2020
by
rcombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/dashdec: support larger manifests
parent
648051f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
dashdec.c
libavformat/dashdec.c
+15
-14
No files found.
libavformat/dashdec.c
View file @
29121188
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
#include "dash.h"
#include "dash.h"
#define INITIAL_BUFFER_SIZE 32768
#define INITIAL_BUFFER_SIZE 32768
#define MAX_MANIFEST_SIZE 50 * 1024
#define DEFAULT_MANIFEST_SIZE 8 * 1024
struct
fragment
{
struct
fragment
{
int64_t
url_offset
;
int64_t
url_offset
;
...
@@ -1220,7 +1222,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
...
@@ -1220,7 +1222,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
int
close_in
=
0
;
int
close_in
=
0
;
uint8_t
*
new_url
=
NULL
;
uint8_t
*
new_url
=
NULL
;
int64_t
filesize
=
0
;
int64_t
filesize
=
0
;
char
*
buffer
=
NULL
;
AVBPrint
buf
;
AVDictionary
*
opts
=
NULL
;
AVDictionary
*
opts
=
NULL
;
xmlDoc
*
doc
=
NULL
;
xmlDoc
*
doc
=
NULL
;
xmlNodePtr
root_element
=
NULL
;
xmlNodePtr
root_element
=
NULL
;
...
@@ -1254,24 +1256,23 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
...
@@ -1254,24 +1256,23 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
}
}
filesize
=
avio_size
(
in
);
filesize
=
avio_size
(
in
);
if
(
filesize
<=
0
)
{
if
(
filesize
>
MAX_MANIFEST_SIZE
)
{
filesize
=
8
*
1024
;
av_log
(
s
,
AV_LOG_ERROR
,
"Manifest too large: %"
PRId64
"
\n
"
,
filesize
);
return
AVERROR_INVALIDDATA
;
}
}
buffer
=
av_mallocz
(
filesize
);
av_bprint_init
(
&
buf
,
(
filesize
>
0
)
?
filesize
+
1
:
DEFAULT_MANIFEST_SIZE
,
AV_BPRINT_SIZE_UNLIMITED
);
if
(
!
buffer
)
{
av_free
(
c
->
base_url
);
return
AVERROR
(
ENOMEM
);
}
filesize
=
avio_read
(
in
,
buffer
,
filesize
);
if
((
ret
=
avio_read_to_bprint
(
in
,
&
buf
,
MAX_MANIFEST_SIZE
))
<
0
||
if
(
filesize
<=
0
)
{
!
avio_feof
(
in
)
||
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to read to offset '%s'
\n
"
,
url
);
(
filesize
=
buf
.
len
)
==
0
)
{
ret
=
AVERROR_INVALIDDATA
;
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to read to manifest '%s'
\n
"
,
url
);
if
(
ret
==
0
)
ret
=
AVERROR_INVALIDDATA
;
}
else
{
}
else
{
LIBXML_TEST_VERSION
LIBXML_TEST_VERSION
doc
=
xmlReadMemory
(
buf
fe
r
,
filesize
,
c
->
base_url
,
NULL
,
0
);
doc
=
xmlReadMemory
(
buf
.
st
r
,
filesize
,
c
->
base_url
,
NULL
,
0
);
root_element
=
xmlDocGetRootElement
(
doc
);
root_element
=
xmlDocGetRootElement
(
doc
);
node
=
root_element
;
node
=
root_element
;
...
@@ -1394,7 +1395,7 @@ cleanup:
...
@@ -1394,7 +1395,7 @@ cleanup:
}
}
av_free
(
new_url
);
av_free
(
new_url
);
av_
free
(
buffer
);
av_
bprint_finalize
(
&
buf
,
NULL
);
if
(
close_in
)
{
if
(
close_in
)
{
avio_close
(
in
);
avio_close
(
in
);
}
}
...
...
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