[vlc-devel] [PATCH v2 1/6] video_output: change the filters before checking for late frames

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 9 10:32:30 CET 2020


Changing the filters may be slow so we may skip this decoded frame and display
the next one.
---
 src/video_output/video_output.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 57ee54e6e8b..fa68a54a8f7 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1080,6 +1080,20 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus
             decoded = picture_fifo_Pop(sys->decoder_fifo);
 
             if (decoded) {
+                vlc_video_context *pic_vctx = picture_GetVideoContext(decoded);
+                if (!VideoFormatIsCropArEqual(&decoded->format, &sys->filter.src_fmt))
+                {
+                    // we received an aspect ratio change
+                    // Update the filters with the filter source format with the new aspect ratio
+                    video_format_Clean(&sys->filter.src_fmt);
+                    video_format_Copy(&sys->filter.src_fmt, &decoded->format);
+                    if (sys->filter.src_vctx)
+                        vlc_video_context_Release(sys->filter.src_vctx);
+                    sys->filter.src_vctx = pic_vctx ? vlc_video_context_Hold(pic_vctx) : NULL;
+
+                    ThreadChangeFilters(vout);
+                }
+
                 const vlc_tick_t system_now = vlc_tick_now();
                 const vlc_tick_t system_pts =
                     vlc_clock_ConvertToSystem(sys->clock, system_now,
@@ -1113,19 +1127,6 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus
                         vout_statistic_AddLate(&sys->statistic, 1);
                     }
                 }
-                vlc_video_context *pic_vctx = picture_GetVideoContext(decoded);
-                if (!VideoFormatIsCropArEqual(&decoded->format, &sys->filter.src_fmt))
-                {
-                    // we received an aspect ratio change
-                    // Update the filters with the filter source format with the new aspect ratio
-                    video_format_Clean(&sys->filter.src_fmt);
-                    video_format_Copy(&sys->filter.src_fmt, &decoded->format);
-                    if (sys->filter.src_vctx)
-                        vlc_video_context_Release(sys->filter.src_vctx);
-                    sys->filter.src_vctx = pic_vctx ? vlc_video_context_Hold(pic_vctx) : NULL;
-
-                    ThreadChangeFilters(vout);
-                }
             }
         }
 
-- 
2.26.2



More information about the vlc-devel mailing list