[vlc-commits] video_output: change the filters before checking for late frames

Steve Lhomme git at videolan.org
Fri Nov 13 16:52:50 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  6 13:18:28 2020 +0100| [14588c7d066ba624e0a21edf73083af4024446aa] | committer: Steve Lhomme

video_output: change the filters before checking for late frames

Changing the filters may be slow so we may skip this decoded frame and display
the next one.

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

 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 3247bb2594..90a004931d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1083,6 +1083,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, can_flush);
+                }
+
                 const vlc_tick_t system_now = vlc_tick_now();
                 const vlc_tick_t system_pts =
                     vlc_clock_ConvertToSystem(sys->clock, system_now,
@@ -1116,19 +1130,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, can_flush);
-                }
             }
         }
 



More information about the vlc-commits mailing list