Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
04e2e588
Commit
04e2e588
authored
Dec 14, 2010
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter/httplive.c: improve locking of hls stream instances
Make locking more consistent.
parent
86589cdb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
10 deletions
+40
-10
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+40
-10
No files found.
modules/stream_filter/httplive.c
View file @
04e2e588
...
...
@@ -774,6 +774,8 @@ static int parse_HTTPLiveStreaming(stream_t *s)
if
(
p_sys
->
b_live
)
{
vlc_mutex_lock
(
&
hls
->
lock
);
/* There should at least be 3 segments of hls->duration */
int
ok
=
0
;
int
num
=
vlc_array_count
(
hls
->
segments
);
...
...
@@ -786,11 +788,16 @@ static int parse_HTTPLiveStreaming(stream_t *s)
if
(
ok
<
3
)
{
msg_Err
(
s
,
"cannot start live playback at this time, try again later."
);
vlc_mutex_unlock
(
&
hls
->
lock
);
return
VLC_EGENERIC
;
}
/* Determine next time to reload playlist */
p_sys
->
wakeup
=
p_sys
->
last
+
(
hls
->
duration
*
2
*
(
mtime_t
)
1000000
);
vlc_mutex_unlock
(
&
hls
->
lock
);
}
/* Can we cache files after playback */
p_sys
->
b_cache
=
hls
->
b_cache
;
}
...
...
@@ -1263,14 +1270,19 @@ static segment_t *NextSegment(stream_t *s)
hls_stream_t
*
hls
=
hls_Get
(
p_sys
->
hls_stream
,
p_sys
->
current
);
if
(
hls
!=
NULL
)
{
vlc_mutex_lock
(
&
hls
->
lock
);
segment
=
segment_GetSegment
(
hls
,
p_sys
->
segment
);
if
(
segment
!=
NULL
)
{
/* This segment is ready? */
if
(
segment
->
data
!=
NULL
)
{
vlc_mutex_unlock
(
&
hls
->
lock
);
return
segment
;
}
}
vlc_mutex_unlock
(
&
hls
->
lock
);
}
/* Was the HLS stream changed to another bitrate? */
int
i_stream
=
0
;
...
...
@@ -1279,26 +1291,37 @@ static segment_t *NextSegment(stream_t *s)
{
/* Is the next segment ready */
hls_stream_t
*
hls
=
hls_Get
(
p_sys
->
hls_stream
,
i_stream
);
if
(
hls
==
NULL
)
return
NULL
;
if
(
hls
==
NULL
)
return
NULL
;
vlc_mutex_lock
(
&
hls
->
lock
);
segment
=
segment_GetSegment
(
hls
,
p_sys
->
segment
);
if
(
segment
==
NULL
)
return
NULL
;
if
(
segment
==
NULL
)
{
vlc_mutex_unlock
(
&
hls
->
lock
);
break
;
}
/* This segment is ready? */
if
(
segment
->
data
!=
NULL
)
goto
segment_ok
;
if
((
segment
->
data
!=
NULL
)
&&
(
p_sys
->
segment
<
p_sys
->
thread
->
segment
))
{
p_sys
->
current
=
i_stream
;
vlc_mutex_unlock
(
&
hls
->
lock
);
return
segment
;
}
vlc_mutex_unlock
(
&
hls
->
lock
);
if
(
!
p_sys
->
b_meta
)
return
NULL
;
if
(
!
p_sys
->
b_meta
)
break
;
/* Was the stream changed to another bitrate? */
i_stream
++
;
if
(
i_stream
>=
vlc_array_count
(
p_sys
->
hls_stream
))
return
NULL
;
break
;
}
segment_ok:
p_sys
->
current
=
i_stream
;
return
segment
;
/* */
return
NULL
;
}
static
ssize_t
hls_Read
(
stream_t
*
s
,
uint8_t
*
p_read
,
unsigned
int
i_read
)
...
...
@@ -1450,6 +1473,8 @@ static uint64_t GetStreamSize(stream_t *s)
hls_stream_t
*
hls
=
hls_Get
(
p_sys
->
hls_stream
,
p_sys
->
current
);
if
(
hls
==
NULL
)
return
0
;
vlc_mutex_lock
(
&
hls
->
lock
);
/* FIXME: Stream size is not entirely exacts at this point */
uint64_t
length
=
0UL
;
int
count
=
vlc_array_count
(
hls
->
segments
);
...
...
@@ -1462,6 +1487,8 @@ static uint64_t GetStreamSize(stream_t *s)
(
segment
->
length
*
hls
->
bandwidth
);
}
}
vlc_mutex_unlock
(
&
hls
->
lock
);
return
length
;
}
...
...
@@ -1477,7 +1504,10 @@ static int segment_Seek(stream_t *s, uint64_t pos)
uint64_t
length
=
0
;
bool
b_found
=
false
;
vlc_mutex_lock
(
&
hls
->
lock
);
int
count
=
vlc_array_count
(
hls
->
segments
);
vlc_mutex_unlock
(
&
hls
->
lock
);
for
(
int
n
=
0
;
n
<
count
;
n
++
)
{
/* FIXME: Seeking in segments not dowloaded is not supported. */
...
...
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