Commit 8e07ff9c authored by Laurent Aimar's avatar Laurent Aimar

Moved out the code retreiving a decoded picture from ThreadDisplayPicture.

No functional changes.
parent b8a46d56
...@@ -549,18 +549,15 @@ static int VoutVideoFilterAllocationSetup(filter_t *filter, void *data) ...@@ -549,18 +549,15 @@ static int VoutVideoFilterAllocationSetup(filter_t *filter, void *data)
} }
/* */ /* */
static int ThreadDisplayPicture(vout_thread_t *vout, static picture_t *ThreadDisplayGetDecodedPicture(vout_thread_t *vout,
int *lost_count, bool *is_forced,
bool now, mtime_t *deadline) bool now, mtime_t *deadline)
{ {
vout_display_t *vd = vout->p->display.vd; vout_display_t *vd = vout->p->display.vd;
int displayed_count = 0;
int lost_count = 0;
for (;;) {
const mtime_t date = mdate(); const mtime_t date = mdate();
const bool is_paused = vout->p->pause.is_on; const bool is_paused = vout->p->pause.is_on;
bool redisplay = is_paused && !now && vout->p->displayed.decoded; bool redisplay = is_paused && !now && vout->p->displayed.decoded;
bool is_forced;
/* FIXME/XXX we must redisplay the last decoded picture (because /* FIXME/XXX we must redisplay the last decoded picture (because
* of potential vout updated, or filters update or SPU update) * of potential vout updated, or filters update or SPU update)
...@@ -574,8 +571,8 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -574,8 +571,8 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
if (!redisplay) { if (!redisplay) {
picture_t *peek = picture_fifo_Peek(vout->p->decoder_fifo); picture_t *peek = picture_fifo_Peek(vout->p->decoder_fifo);
if (peek) { if (peek) {
is_forced = peek->b_force || is_paused || now; *is_forced = peek->b_force || is_paused || now;
*deadline = (is_forced ? date : peek->date) - vout_chrono_GetHigh(&vout->p->render); *deadline = (*is_forced ? date : peek->date) - vout_chrono_GetHigh(&vout->p->render);
picture_Release(peek); picture_Release(peek);
} else { } else {
redisplay = true; redisplay = true;
...@@ -586,10 +583,10 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -586,10 +583,10 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
const mtime_t date_update = vout->p->displayed.date + VOUT_REDISPLAY_DELAY; const mtime_t date_update = vout->p->displayed.date + VOUT_REDISPLAY_DELAY;
if (date_update > date || !vout->p->displayed.decoded) { if (date_update > date || !vout->p->displayed.decoded) {
*deadline = vout->p->displayed.decoded ? date_update : VLC_TS_INVALID; *deadline = vout->p->displayed.decoded ? date_update : VLC_TS_INVALID;
break; return NULL;
} }
/* */ /* */
is_forced = true; *is_forced = true;
*deadline = date - vout_chrono_GetHigh(&vout->p->render); *deadline = date - vout_chrono_GetHigh(&vout->p->render);
} }
if (*deadline > VOUT_MWAIT_TOLERANCE) if (*deadline > VOUT_MWAIT_TOLERANCE)
...@@ -597,7 +594,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -597,7 +594,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
/* If we are too early and can wait, do it */ /* If we are too early and can wait, do it */
if (date < *deadline && !now) if (date < *deadline && !now)
break; return NULL;
picture_t *decoded; picture_t *decoded;
if (redisplay) { if (redisplay) {
...@@ -606,7 +603,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -606,7 +603,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
} else { } else {
decoded = picture_fifo_Pop(vout->p->decoder_fifo); decoded = picture_fifo_Pop(vout->p->decoder_fifo);
assert(decoded); assert(decoded);
if (!is_forced && !vout->p->is_late_dropped) { if (!*is_forced && !vout->p->is_late_dropped) {
const mtime_t predicted = date + vout_chrono_GetLow(&vout->p->render); const mtime_t predicted = date + vout_chrono_GetLow(&vout->p->render);
const mtime_t late = predicted - decoded->date; const mtime_t late = predicted - decoded->date;
if (late > 0) { if (late > 0) {
...@@ -615,8 +612,8 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -615,8 +612,8 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
msg_Warn(vout, "rejected picture because of render time"); msg_Warn(vout, "rejected picture because of render time");
/* TODO */ /* TODO */
picture_Release(decoded); picture_Release(decoded);
lost_count++; (*lost_count)++;
break; return NULL;
} }
} }
} }
...@@ -632,6 +629,24 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -632,6 +629,24 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
picture_Hold(decoded); picture_Hold(decoded);
vout->p->displayed.decoded = decoded; vout->p->displayed.decoded = decoded;
return decoded;
}
static int ThreadDisplayPicture(vout_thread_t *vout,
bool now, mtime_t *deadline)
{
vout_display_t *vd = vout->p->display.vd;
int displayed_count = 0;
int lost_count = 0;
for (;;) {
bool is_forced;
picture_t *decoded = ThreadDisplayGetDecodedPicture(vout,
&lost_count, &is_forced,
now, deadline);
if (!decoded)
break;
/* */ /* */
vout_chrono_Start(&vout->p->render); vout_chrono_Start(&vout->p->render);
......
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