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
513a431e
Commit
513a431e
authored
Apr 11, 2014
by
Michael Schenk
Committed by
Anssi Hannula
Apr 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/hls: reduce memory usage by using dynamically allocated url/key
Signed-off-by:
Anssi Hannula
<
anssi.hannula@iki.fi
>
parent
66e95968
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
hls.c
libavformat/hls.c
+29
-5
No files found.
libavformat/hls.c
View file @
513a431e
...
@@ -68,8 +68,8 @@ struct segment {
...
@@ -68,8 +68,8 @@ struct segment {
int64_t
duration
;
int64_t
duration
;
int64_t
url_offset
;
int64_t
url_offset
;
int64_t
size
;
int64_t
size
;
char
url
[
MAX_URL_SIZE
]
;
char
*
url
;
char
key
[
MAX_URL_SIZE
]
;
char
*
key
;
enum
KeyType
key_type
;
enum
KeyType
key_type
;
uint8_t
iv
[
16
];
uint8_t
iv
[
16
];
};
};
...
@@ -192,8 +192,11 @@ static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
...
@@ -192,8 +192,11 @@ static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
static
void
free_segment_list
(
struct
playlist
*
pls
)
static
void
free_segment_list
(
struct
playlist
*
pls
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
pls
->
n_segments
;
i
++
)
for
(
i
=
0
;
i
<
pls
->
n_segments
;
i
++
)
{
av_free
(
pls
->
segments
[
i
]
->
key
);
av_free
(
pls
->
segments
[
i
]
->
url
);
av_free
(
pls
->
segments
[
i
]);
av_free
(
pls
->
segments
[
i
]);
}
av_freep
(
&
pls
->
segments
);
av_freep
(
&
pls
->
segments
);
pls
->
n_segments
=
0
;
pls
->
n_segments
=
0
;
}
}
...
@@ -504,6 +507,7 @@ static int parse_playlist(HLSContext *c, const char *url,
...
@@ -504,6 +507,7 @@ static int parse_playlist(HLSContext *c, const char *url,
int64_t
seg_size
=
-
1
;
int64_t
seg_size
=
-
1
;
uint8_t
*
new_url
=
NULL
;
uint8_t
*
new_url
=
NULL
;
struct
variant_info
variant_info
;
struct
variant_info
variant_info
;
char
tmp_str
[
MAX_URL_SIZE
];
if
(
!
in
)
{
if
(
!
in
)
{
AVDictionary
*
opts
=
NULL
;
AVDictionary
*
opts
=
NULL
;
...
@@ -624,8 +628,28 @@ static int parse_playlist(HLSContext *c, const char *url,
...
@@ -624,8 +628,28 @@ static int parse_playlist(HLSContext *c, const char *url,
memset
(
seg
->
iv
,
0
,
sizeof
(
seg
->
iv
));
memset
(
seg
->
iv
,
0
,
sizeof
(
seg
->
iv
));
AV_WB32
(
seg
->
iv
+
12
,
seq
);
AV_WB32
(
seg
->
iv
+
12
,
seq
);
}
}
ff_make_absolute_url
(
seg
->
key
,
sizeof
(
seg
->
key
),
url
,
key
);
ff_make_absolute_url
(
seg
->
url
,
sizeof
(
seg
->
url
),
url
,
line
);
if
(
key_type
!=
KEY_NONE
)
{
ff_make_absolute_url
(
tmp_str
,
sizeof
(
tmp_str
),
url
,
key
);
seg
->
key
=
av_strdup
(
tmp_str
);
if
(
!
seg
->
key
)
{
av_free
(
seg
);
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
}
else
{
seg
->
key
=
NULL
;
}
ff_make_absolute_url
(
tmp_str
,
sizeof
(
tmp_str
),
url
,
line
);
seg
->
url
=
av_strdup
(
tmp_str
);
if
(
!
seg
->
url
)
{
av_free
(
seg
->
key
);
av_free
(
seg
);
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
dynarray_add
(
&
pls
->
segments
,
&
pls
->
n_segments
,
seg
);
dynarray_add
(
&
pls
->
segments
,
&
pls
->
n_segments
,
seg
);
is_segment
=
0
;
is_segment
=
0
;
...
...
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