Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
70459ae3
Commit
70459ae3
authored
Oct 10, 2012
by
Frédéric Yhuel
Committed by
Jean-Baptiste Kempf
Oct 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Smooth Streaming: fix some memory leaks
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
9c64ad34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
24 deletions
+42
-24
modules/stream_filter/smooth/smooth.c
modules/stream_filter/smooth/smooth.c
+13
-17
modules/stream_filter/smooth/smooth.h
modules/stream_filter/smooth/smooth.h
+1
-0
modules/stream_filter/smooth/utils.c
modules/stream_filter/smooth/utils.c
+28
-7
No files found.
modules/stream_filter/smooth/smooth.c
View file @
70459ae3
...
...
@@ -146,9 +146,7 @@ static int parse_Manifest( stream_t *s )
}
const
char
*
node
;
char
*
stream_name
=
NULL
;
uint8_t
*
WaveFormatEx
;
int
stream_type
=
UNKNOWN_ES
;
sms_stream_t
*
sms
=
NULL
;
quality_level_t
*
ql
=
NULL
;
int64_t
start_time
=
0
,
duration
=
0
;
...
...
@@ -192,15 +190,15 @@ static int parse_Manifest( stream_t *s )
if
(
!
strcmp
(
name
,
"Type"
)
)
{
if
(
!
strcmp
(
value
,
"video"
)
)
s
tream_
type
=
VIDEO_ES
;
s
ms
->
type
=
VIDEO_ES
;
else
if
(
!
strcmp
(
value
,
"audio"
)
)
s
tream_
type
=
AUDIO_ES
;
s
ms
->
type
=
AUDIO_ES
;
else
if
(
!
strcmp
(
value
,
"text"
)
)
s
tream_
type
=
SPU_ES
;
s
ms
->
type
=
SPU_ES
;
}
if
(
!
strcmp
(
name
,
"Name"
)
)
s
tream_
name
=
strdup
(
value
);
s
ms
->
name
=
strdup
(
value
);
if
(
!
strcmp
(
name
,
"TimeScale"
)
)
sms
->
timescale
=
strtoull
(
value
,
NULL
,
10
);
if
(
!
strcmp
(
name
,
"FourCC"
)
)
...
...
@@ -222,18 +220,16 @@ static int parse_Manifest( stream_t *s )
if
(
sms
&&
!
sms
->
timescale
)
sms
->
timescale
=
TIMESCALE
;
if
(
!
s
tream_
name
)
if
(
!
s
ms
->
name
)
{
if
(
s
tream_
type
==
VIDEO_ES
)
s
tream_
name
=
strdup
(
"video"
);
else
if
(
s
tream_
type
==
AUDIO_ES
)
s
tream_
name
=
strdup
(
"audio"
);
else
if
(
s
tream_
type
==
SPU_ES
)
s
tream_
name
=
strdup
(
"text"
);
if
(
s
ms
->
type
==
VIDEO_ES
)
s
ms
->
name
=
strdup
(
"video"
);
else
if
(
s
ms
->
type
==
AUDIO_ES
)
s
ms
->
name
=
strdup
(
"audio"
);
else
if
(
s
ms
->
type
==
SPU_ES
)
s
ms
->
name
=
strdup
(
"text"
);
}
sms
->
name
=
stream_name
;
sms
->
type
=
stream_type
;
vlc_array_append
(
p_sys
->
sms_streams
,
sms
);
}
...
...
@@ -346,8 +342,6 @@ static int parse_Manifest( stream_t *s )
if
(
strcmp
(
node
,
"StreamIndex"
)
)
break
;
stream_name
=
NULL
;
stream_type
=
UNKNOWN_ES
;
computed_start_time
=
0
;
computed_duration
=
0
;
loop_count
=
0
;
...
...
@@ -502,7 +496,9 @@ static void Close( vlc_object_t *p_this )
sms_Free
(
sms
);
}
sms_queue_free
(
p_sys
->
bws
);
vlc_array_destroy
(
p_sys
->
sms_streams
);
vlc_array_destroy
(
p_sys
->
selected_st
);
vlc_array_destroy
(
p_sys
->
download
.
chunks
);
free
(
p_sys
->
base_url
);
...
...
modules/stream_filter/smooth/smooth.h
View file @
70459ae3
...
...
@@ -165,6 +165,7 @@ struct stream_sys_t
#define NO_MORE_CHUNKS ( !p_sys->b_live && \
no_more_chunks( p_sys->download.ck_index, p_sys->selected_st ) )
void
sms_queue_free
(
sms_queue_t
*
);
sms_queue_t
*
sms_queue_init
(
const
int
);
int
sms_queue_put
(
sms_queue_t
*
,
const
uint64_t
);
uint64_t
sms_queue_avg
(
sms_queue_t
*
);
...
...
modules/stream_filter/smooth/utils.c
View file @
70459ae3
...
...
@@ -136,6 +136,8 @@ void sms_Free( sms_stream_t *sms )
vlc_array_destroy
(
sms
->
chunks
);
}
free
(
sms
->
name
);
free
(
sms
->
url_template
);
free
(
sms
);
sms
=
NULL
;
}
...
...
@@ -162,18 +164,37 @@ sms_queue_t *sms_queue_init( const int length )
return
ret
;
}
void
sms_queue_free
(
sms_queue_t
*
queue
)
{
item_t
*
item
=
queue
->
first
,
*
next
=
NULL
;
while
(
item
)
{
next
=
item
->
next
;
FREENULL
(
item
);
item
=
next
;
}
FREENULL
(
queue
);
}
int
sms_queue_put
(
sms_queue_t
*
queue
,
const
uint64_t
value
)
{
item_t
*
last
=
queue
->
first
;
int
i
=
0
;
for
(
i
=
0
;
i
<
queue
->
length
-
1
;
i
++
)
/* Remove the last (and oldest) item */
item_t
*
item
,
*
prev
;
int
count
=
0
;
for
(
item
=
queue
->
first
;
item
!=
NULL
;
item
=
item
->
next
)
{
if
(
last
)
last
=
last
->
next
;
count
++
;
if
(
count
==
queue
->
length
)
{
FREENULL
(
item
);
if
(
prev
)
prev
->
next
=
NULL
;
break
;
}
else
prev
=
item
;
}
if
(
i
==
queue
->
length
-
1
)
FREENULL
(
last
);
/* Now insert the new item */
item_t
*
new
=
malloc
(
sizeof
(
item_t
)
);
if
(
unlikely
(
!
new
)
)
return
VLC_ENOMEM
;
...
...
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