[vlc-commits] decoder: remove vout_FixLeaks()
Rémi Denis-Courmont
git at videolan.org
Fri Apr 24 22:47:03 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 29 17:08:00 2014 +0200| [e56293ead3bbcf1f6f395e4808d9cb54e6d9e627] | committer: Rémi Denis-Courmont
decoder: remove vout_FixLeaks()
This function was intended to work around a certain class of bugs
inside video decoders whereby the a reference picture was never
dereferenced, i.e. missing decoder_UnlinkPicture() call.
There are however some situations where this hack would release a
still referenced picture:
- If the video output or decoder has a high latency or if a video
filter holds pictures (deinterlace), there may be zero free pictures
even though the total number of pictures is sufficient overall.
In that case, waiting for a picture buffer to be released normally
is the right and safe approach.
- If the byte stream is invalid or corrupt such that the number of
required pictures (DPB size) is underestimated, dropping frames is
acceptable. Frames would be corrupt anyway due to missing references.
(This case could be better worked around by allocating extra
pictures on-the-fly, though this would require memory copying in the
video output.)
- Even if the decoder indeed leaks pictures, the oldest referenced
picture is not necessarily among those leaked.
If the picture was not truly leaked, vout_FixLeaks() would cause an
extraneous picture release. This should lead to an assertion failure in
picture_Release(). Without assertions, it would lead to undefined
behaviour, especially invalid pointer use in case of hardware surfaces.
In any case, picture leaks are still recovered when resetting the video
output with vout_Reset(), after the decoder is destroyed. That might
turn out to be a problem too though.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e56293ead3bbcf1f6f395e4808d9cb54e6d9e627
---
src/input/decoder.c | 3 ---
src/video_output/video_output.c | 21 ---------------------
src/video_output/vout_control.h | 8 --------
3 files changed, 32 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index e8eaf91..c4265a4 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -443,9 +443,6 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
}
vlc_mutex_unlock( &p_owner->lock );
- /* Check the decoder doesn't leak pictures */
- vout_FixLeaks( p_owner->p_vout );
-
/* FIXME add a vout_WaitPictureAvailable (timedwait) */
msleep( VOUT_OUTMEM_SLEEP );
}
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index cdb04e5..d5aee4d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -335,27 +335,6 @@ bool vout_IsEmpty(vout_thread_t *vout)
return !picture;
}
-void vout_FixLeaks( vout_thread_t *vout )
-{
- picture_t *picture = picture_fifo_Peek(vout->p->decoder_fifo);
- if (picture != NULL) {
- picture_Release(picture);
- return; /* Not all pictures has been displayed yet */
-
- }
-
- picture = picture_pool_Get(vout->p->decoder_pool);
-
- if (picture != NULL)
- picture_Release(picture); /* Not all pictures are referenced */
- else {
- /* There are no reasons that no pictures are available, force one
- * from the pool, be careful with it though */
- msg_Err(vout, "pictures leaked, trying to workaround");
- picture_pool_NonEmpty(vout->p->decoder_pool);
- }
-}
-
void vout_NextPicture(vout_thread_t *vout, mtime_t *duration)
{
vout_control_cmd_t cmd;
diff --git a/src/video_output/vout_control.h b/src/video_output/vout_control.h
index 12b057d..2cbb9f9 100644
--- a/src/video_output/vout_control.h
+++ b/src/video_output/vout_control.h
@@ -47,14 +47,6 @@ void vout_GetResetStatistic( vout_thread_t *p_vout, int *pi_displayed, int *pi_l
*/
void vout_Flush( vout_thread_t *p_vout, mtime_t i_date );
-/**
- * This function will try to detect if pictures are being leaked. If so it
- * will release them.
- *
- * XXX This function is there to workaround bugs in decoder
- */
-void vout_FixLeaks( vout_thread_t *p_vout );
-
/*
* Reset the states of the vout.
*/
More information about the vlc-commits
mailing list