Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
07e428de
Commit
07e428de
authored
Oct 29, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
picture_pool: split picture_pool_NonEmpty and picture_pool_Reset
parent
3ca607e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
21 deletions
+40
-21
include/vlc_picture_pool.h
include/vlc_picture_pool.h
+10
-3
src/misc/picture_pool.c
src/misc/picture_pool.c
+28
-16
src/video_output/video_output.c
src/video_output/video_output.c
+2
-2
No files found.
include/vlc_picture_pool.h
View file @
07e428de
...
...
@@ -93,18 +93,25 @@ VLC_API void picture_pool_Delete( picture_pool_t * );
*/
VLC_API
picture_t
*
picture_pool_Get
(
picture_pool_t
*
)
VLC_USED
;
/**
* Forcefully return all pictures in the pool to free/unallocated state.
*
* @warning This can only be called when it is known that all pending
* references to the picture pool are stale, e.g. a decoder failed to
* release pictures properly when it terminated.
*/
void
picture_pool_Reset
(
picture_pool_t
*
);
/**
* It forces the next picture_pool_Get to return a picture even if no
* pictures are free.
*
* If b_reset is true, all pictures will be marked as free.
*
* It does it by releasing itself the oldest used picture if none is
* available.
* XXX it should be used with great care, the only reason you may need
* it is to workaround a bug.
*/
VLC_API
void
picture_pool_NonEmpty
(
picture_pool_t
*
,
bool
reset
);
VLC_API
void
picture_pool_NonEmpty
(
picture_pool_t
*
);
/**
* It reserves picture_count pictures from the given pool and returns
...
...
src/misc/picture_pool.c
View file @
07e428de
...
...
@@ -289,31 +289,43 @@ picture_t *picture_pool_Get(picture_pool_t *pool)
return
NULL
;
}
void
picture_pool_
NonEmpty
(
picture_pool_t
*
pool
,
bool
reset
)
void
picture_pool_
Reset
(
picture_pool_t
*
pool
)
{
picture_t
*
old
=
NULL
;
for
(
int
i
=
0
;
i
<
pool
->
picture_count
;
i
++
)
{
if
(
pool
->
picture_reserved
[
i
])
continue
;
picture_t
*
picture
=
pool
->
picture
[
i
];
if
(
reset
)
{
if
(
atomic_load
(
&
picture
->
gc
.
refcount
)
>
0
)
Unlock
(
picture
);
atomic_store
(
&
picture
->
gc
.
refcount
,
0
);
}
else
if
(
atomic_load
(
&
picture
->
gc
.
refcount
)
==
0
)
{
return
;
}
else
if
(
!
old
||
picture
->
gc
.
p_sys
->
tick
<
old
->
gc
.
p_sys
->
tick
)
{
old
=
picture
;
}
if
(
atomic_load
(
&
picture
->
gc
.
refcount
)
>
0
)
Unlock
(
picture
);
atomic_store
(
&
picture
->
gc
.
refcount
,
0
);
}
if
(
!
reset
&&
old
)
{
if
(
atomic_load
(
&
old
->
gc
.
refcount
)
>
0
)
Unlock
(
old
);
atomic_store
(
&
old
->
gc
.
refcount
,
0
);
}
void
picture_pool_NonEmpty
(
picture_pool_t
*
pool
)
{
picture_t
*
oldest
=
NULL
;
for
(
int
i
=
0
;
i
<
pool
->
picture_count
;
i
++
)
{
if
(
pool
->
picture_reserved
[
i
])
continue
;
picture_t
*
picture
=
pool
->
picture
[
i
];
if
(
atomic_load
(
&
picture
->
gc
.
refcount
)
==
0
)
return
;
/* Nothing to do */
if
(
oldest
==
NULL
||
picture
->
gc
.
p_sys
->
tick
<
oldest
->
gc
.
p_sys
->
tick
)
oldest
=
picture
;
}
if
(
oldest
==
NULL
)
return
;
/* Cannot fix! */
if
(
atomic_load
(
&
oldest
->
gc
.
refcount
)
>
0
)
Unlock
(
oldest
);
atomic_store
(
&
oldest
->
gc
.
refcount
,
0
);
}
int
picture_pool_GetSize
(
picture_pool_t
*
pool
)
{
return
pool
->
picture_count
;
...
...
src/video_output/video_output.c
View file @
07e428de
...
...
@@ -363,7 +363,7 @@ void vout_FixLeaks( vout_thread_t *vout )
msg_Err
(
vout
,
"pictures leaked, trying to workaround"
);
/* */
picture_pool_NonEmpty
(
vout
->
p
->
decoder_pool
,
false
);
picture_pool_NonEmpty
(
vout
->
p
->
decoder_pool
);
vlc_mutex_unlock
(
&
vout
->
p
->
picture_lock
);
}
...
...
@@ -1232,7 +1232,7 @@ static void ThreadReset(vout_thread_t *vout)
{
ThreadFlush
(
vout
,
true
,
INT64_MAX
);
if
(
vout
->
p
->
decoder_pool
)
picture_pool_
NonEmpty
(
vout
->
p
->
decoder_pool
,
true
);
picture_pool_
Reset
(
vout
->
p
->
decoder_pool
);
vout
->
p
->
pause
.
is_on
=
false
;
vout
->
p
->
pause
.
date
=
mdate
();
}
...
...
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