[vlc-commits] picture: remove dysfunctional picture_IsReferenced()

Rémi Denis-Courmont git at videolan.org
Sat Nov 4 13:53:44 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov  4 14:51:07 2017 +0200| [d9a0c08a9c03d78d3500d35c7839a1b6a10b1271] | committer: Rémi Denis-Courmont

picture: remove dysfunctional picture_IsReferenced()

Nowadays, multiple pictures might share the same buffers. Consequently
the reference count of a single picture may be one even though there
are other references to the same buffers through a different picture.

Luckily picture_IsReferenced() is only really used in one place in
stream output, and then it was only an optimization.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d9a0c08a9c03d78d3500d35c7839a1b6a10b1271
---

 include/vlc_picture.h                | 8 --------
 modules/hw/vdpau/picture.c           | 1 -
 modules/stream_out/transcode/video.c | 2 +-
 src/libvlccore.sym                   | 1 -
 src/misc/picture.c                   | 7 -------
 5 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index e25374634f..3d71633fe4 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -159,14 +159,6 @@ VLC_API picture_t *picture_Hold( picture_t *p_picture );
 VLC_API void picture_Release( picture_t *p_picture );
 
 /**
- * This function will return true if you are not the only owner of the
- * picture.
- *
- * It is only valid if it is created using picture_New.
- */
-VLC_API bool picture_IsReferenced( picture_t *p_picture );
-
-/**
  * This function will copy all picture dynamic properties.
  */
 VLC_API void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src );
diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
index 4c42eef719..2264de8e01 100644
--- a/modules/hw/vdpau/picture.c
+++ b/modules/hw/vdpau/picture.c
@@ -120,7 +120,6 @@ VdpStatus vlc_vdp_video_attach(vdp_t *vdp, VdpVideoSurface surface,
     assert(pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_420
         || pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_422
         || pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_444);
-    assert(!picture_IsReferenced(pic));
     assert(pic->context == NULL);
     pic->context = &field->context;
     return VDP_STATUS_OK;
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 3e8637ae0a..8de3f80bfc 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -710,7 +710,7 @@ static void OutputFrame( sout_stream_t *p_stream, picture_t *p_pic, sout_stream_
         /* Overlay subpicture */
         if( p_subpic )
         {
-            if( picture_IsReferenced( p_pic ) && filter_chain_IsEmpty( id->p_f_chain ) )
+            if( filter_chain_IsEmpty( id->p_f_chain ) )
             {
                 /* We can't modify the picture, we need to duplicate it,
                  * in this point the picture is already p_encoder->fmt.in format*/
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 5b1a8bfee8..21316ce2b8 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -298,7 +298,6 @@ picture_BlendSubpicture
 picture_CopyPixels
 picture_Hold
 picture_Release
-picture_IsReferenced
 picture_CopyProperties
 picture_Copy
 picture_Export
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 59d0aaa359..2762358049 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -308,13 +308,6 @@ void picture_Release( picture_t *p_picture )
     priv->gc.destroy( p_picture );
 }
 
-bool picture_IsReferenced( picture_t *p_picture )
-{
-    picture_priv_t *priv = (picture_priv_t *)p_picture;
-
-    return atomic_load( &priv->gc.refs ) > 1;
-}
-
 /*****************************************************************************
  *
  *****************************************************************************/



More information about the vlc-commits mailing list