[vlc-devel] [PATCH] picture_chain: make sure picture we add to a chain don't have chained pictures

Steve Lhomme robux4 at ycbcr.xyz
Thu Oct 15 16:07:37 CEST 2020


---
 include/vlc_picture.h | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index cf2b310ef8f..e5be1be14ab 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -167,6 +167,14 @@ static inline vlc_video_context* picture_GetVideoContext(picture_t *pic)
     return pic->context ? pic->context->vctx : NULL;
 }
 
+/**
+ * Check whether a picture has other pictures linked
+ */
+static inline bool picture_HasChainedPics(const picture_t *pic)
+{
+    return pic->p_next != NULL;
+}
+
 /**
  * picture chaining helpers
  */
@@ -244,6 +252,8 @@ static inline void vlc_picture_chain_Append(vlc_picture_chain_t *chain,
         chain->front = pic;
     else
         chain->tail->p_next = pic;
+    // make sure the picture doesn't have chained pics
+    vlc_assert( !picture_HasChainedPics( pic ) );
     pic->p_next = NULL; // we're appending a picture, not a chain
     chain->tail = pic;
 }
@@ -270,14 +280,6 @@ static inline void vlc_picture_chain_GetAndClear(vlc_picture_chain_t *in,
     vlc_picture_chain_Init(in);
 }
 
-/**
- * Check whether a picture has other pictures linked
- */
-static inline bool picture_HasChainedPics(const picture_t *pic)
-{
-    return pic->p_next != NULL;
-}
-
 /**
  * Reset a picture chain.
  *
-- 
2.26.2



More information about the vlc-devel mailing list