Commit d5ff0152 authored by Rafaël Carré's avatar Rafaël Carré

ThreadDisplayPreparePicture: simplify

parent 6cf55f06
...@@ -816,7 +816,6 @@ static void ThreadChangeFilters(vout_thread_t *vout, ...@@ -816,7 +816,6 @@ static void ThreadChangeFilters(vout_thread_t *vout,
/* */ /* */
static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool frame_by_frame) static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool frame_by_frame)
{ {
int lost_count = 0;
bool is_late_dropped = vout->p->is_late_dropped && !vout->p->pause.is_on && !frame_by_frame; bool is_late_dropped = vout->p->is_late_dropped && !vout->p->pause.is_on && !frame_by_frame;
vlc_mutex_lock(&vout->p->filter.lock); vlc_mutex_lock(&vout->p->filter.lock);
...@@ -830,22 +829,24 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra ...@@ -830,22 +829,24 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra
decoded = picture_Hold(vout->p->displayed.decoded); decoded = picture_Hold(vout->p->displayed.decoded);
} else { } else {
decoded = picture_fifo_Pop(vout->p->decoder_fifo); decoded = picture_fifo_Pop(vout->p->decoder_fifo);
if (is_late_dropped && decoded && !decoded->b_force) { if (decoded) {
if (is_late_dropped && !decoded->b_force) {
const mtime_t predicted = mdate() + 0; /* TODO improve */ const mtime_t predicted = mdate() + 0; /* TODO improve */
const mtime_t late = predicted - decoded->date; const mtime_t late = predicted - decoded->date;
if (late > VOUT_DISPLAY_LATE_THRESHOLD) { if (late > VOUT_DISPLAY_LATE_THRESHOLD) {
msg_Warn(vout, "picture is too late to be displayed (missing %d ms)", (int)(late/1000)); msg_Warn(vout, "picture is too late to be displayed (missing %"PRId64" ms)", late/1000);
picture_Release(decoded); picture_Release(decoded);
lost_count++; vout_statistic_AddLost(&vout->p->statistic, 1);
continue; continue;
} else if (late > 0) { } else if (late > 0) {
msg_Dbg(vout, "picture might be displayed late (missing %d ms)", (int)(late/1000)); msg_Dbg(vout, "picture might be displayed late (missing %"PRId64" ms)", late/1000);
} }
} }
if (decoded && if (!VideoFormatIsCropArEqual(&decoded->format, &vout->p->filter.format))
!VideoFormatIsCropArEqual(&decoded->format, &vout->p->filter.format))
ThreadChangeFilters(vout, &decoded->format, vout->p->filter.configuration, true); ThreadChangeFilters(vout, &decoded->format, vout->p->filter.configuration, true);
} }
}
if (!decoded) if (!decoded)
break; break;
reuse = false; reuse = false;
...@@ -862,7 +863,6 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra ...@@ -862,7 +863,6 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra
vlc_mutex_unlock(&vout->p->filter.lock); vlc_mutex_unlock(&vout->p->filter.lock);
vout_statistic_AddLost(&vout->p->statistic, lost_count);
if (!picture) if (!picture)
return VLC_EGENERIC; return VLC_EGENERIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment