[vlc-commits] vout: ensure expired subpictures are really deleted

Francois Cartegnie git at videolan.org
Thu Nov 8 13:15:37 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov  8 13:04:58 2018 +0100| [a39eb8df51aeb4e6b568416896b2b0e4e7833e9f] | committer: Francois Cartegnie

vout: ensure expired subpictures are really deleted

currently happens only when another subpicture is in the heap
and is valid

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

 include/vlc_vout.h                  | 1 +
 src/video_output/vout_subpictures.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 6bb712c17c..0a4e07f85d 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -104,6 +104,7 @@ VLC_API picture_t * vout_GetPicture( vout_thread_t * );
 VLC_API void vout_PutPicture( vout_thread_t *, picture_t * );
 
 /* Subpictures channels ID */
+#define VOUT_SPU_CHANNEL_INVALID      (-1) /* Always fails in comparison */
 #define VOUT_SPU_CHANNEL_OSD            1 /* OSD channel is automatically cleared */
 #define VOUT_SPU_CHANNEL_AVAIL_FIRST    8 /* Registerable channels from this offset */
 
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 682461a7ac..c627cb284a 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -559,6 +559,10 @@ static void SpuSelectSubpictures(spu_t *spu,
             channel[channel_count++] = i_channel;
     }
 
+    /* Ensure a 1 pass garbage collection for rejected subpictures */
+    if(channel_count == 0)
+        channel[channel_count++] = VOUT_SPU_CHANNEL_INVALID;
+
     /* Fill up the subpicture_array arrays with relevant pictures */
     for (int i = 0; i < channel_count; i++) {
         subpicture_t *available_subpic[VOUT_MAX_SUBPICTURES];
@@ -1639,7 +1643,7 @@ void spu_ClearChannel(spu_t *spu, int channel)
         if (subpic->i_channel != channel && (channel != -1 || subpic->i_channel == VOUT_SPU_CHANNEL_OSD))
             continue;
 
-        /* You cannot delete subpicture outside of spu_SortSubpictures */
+        /* You cannot delete subpicture outside of SpuSelectSubpictures */
         entry->reject = true;
     }
 



More information about the vlc-commits mailing list