[vlc-devel] [PATCH 18/21] video_output: reindent after previous patch
Steve Lhomme
robux4 at ycbcr.xyz
Tue Sep 15 14:36:23 CEST 2020
And exit early if there is no decoded picture.
remove the assert which just checked the filter chain was flushed properly.
---
src/video_output/video_output.c | 100 +++++++++++++++-----------------
1 file changed, 48 insertions(+), 52 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 8310d3417c5..64903aa47b8 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1078,61 +1078,57 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout,
picture_t *picture = filter_chain_VideoFilter(sys->filter.chain_static, NULL);
while (!picture) {
- picture_t *decoded;
- decoded = picture_fifo_Pop(sys->decoder_fifo);
-
- if (decoded) {
- if (is_late_dropped && !decoded->b_force) {
- const vlc_tick_t date = vlc_tick_now();
- const vlc_tick_t system_pts =
- vlc_clock_ConvertToSystem(sys->clock, date,
- decoded->date, sys->rate);
-
- vlc_tick_t late;
- if (system_pts == INT64_MAX)
- {
- /* The clock is paused, notify it (so that the current
- * picture is displayed but not the next one), this
- * current picture can't be be late. */
- *paused = true;
- late = 0;
- }
- else
- late = date - system_pts;
-
- vlc_tick_t late_threshold;
- if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)
- late_threshold = VLC_TICK_FROM_MS(500) * decoded->format.i_frame_rate_base / decoded->format.i_frame_rate;
- else
- late_threshold = VOUT_DISPLAY_LATE_THRESHOLD;
- if (late > late_threshold) {
- msg_Warn(&vout->obj, "picture is too late to be displayed (missing %"PRId64" ms)", MS_FROM_VLC_TICK(late));
- picture_Release(decoded);
- vout_statistic_AddLost(&sys->statistic, 1);
- continue;
- } else if (late > 0) {
- msg_Dbg(&vout->obj, "picture might be displayed late (missing %"PRId64" ms)", MS_FROM_VLC_TICK(late));
- 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);
- }
- }
-
+ picture_t *decoded = picture_fifo_Pop(sys->decoder_fifo);
if (!decoded)
break;
+ if (is_late_dropped && !decoded->b_force) {
+ const vlc_tick_t date = vlc_tick_now();
+ const vlc_tick_t system_pts =
+ vlc_clock_ConvertToSystem(sys->clock, date,
+ decoded->date, sys->rate);
+
+ vlc_tick_t late;
+ if (system_pts == INT64_MAX)
+ {
+ /* The clock is paused, notify it (so that the current
+ * picture is displayed but not the next one), this
+ * current picture can't be be late. */
+ *paused = true;
+ late = 0;
+ }
+ else
+ late = date - system_pts;
+
+ vlc_tick_t late_threshold;
+ if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)
+ late_threshold = VLC_TICK_FROM_MS(500) * decoded->format.i_frame_rate_base / decoded->format.i_frame_rate;
+ else
+ late_threshold = VOUT_DISPLAY_LATE_THRESHOLD;
+ if (late > late_threshold) {
+ msg_Warn(&vout->obj, "picture is too late to be displayed (missing %"PRId64" ms)", MS_FROM_VLC_TICK(late));
+ picture_Release(decoded);
+ vout_statistic_AddLost(&sys->statistic, 1);
+ continue;
+ } else if (late > 0) {
+ msg_Dbg(&vout->obj, "picture might be displayed late (missing %"PRId64" ms)", MS_FROM_VLC_TICK(late));
+ 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);
+ }
+
if (sys->displayed.decoded)
picture_Release(sys->displayed.decoded);
--
2.26.2
More information about the vlc-devel
mailing list