summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-07 05:29:26 +0100
committerwm4 <wm4@nowhere>2017-11-07 05:29:26 +0100
commit793b43020c784047b60a7b9f3461ff3b9fe90d02 (patch)
tree5f4a9f8df0b4d040d36683db8aae1408d4bf1479 /video/out
parenta2a623ebb9309d05113bd400449b618aa21f783f (diff)
downloadmpv-793b43020c784047b60a7b9f3461ff3b9fe90d02.tar.bz2
mpv-793b43020c784047b60a7b9f3461ff3b9fe90d02.tar.xz
vo_lavc: remove messy delayed subtitle rendering logic
For some reason vo_lavc's draw_image can buffer the frame and encode it only later. Also, there is logic for rendering the OSD (i.e. subtitles) only when needed. In theory this can lead to subtitles being pruned before it tries to render them (as the subtitle logic doesn't know that the VO still needs them later), although this probably never happens in reality. The worse issue, that actually happened, is that if the last frame gets buffered, it attempts to render subtitles in the uninit callback. At this point, the subtitle decoder is already torn down and all subtitles removed, thus it will draw nothing. This didn't always happen. I'm not sure why - potentially in the working cases, the frame wasn't buffered. Since this logic doesn't have much worth, except a minor performance advantage if frames with subtitles are dropped, just remove it. Hopefully fixes #4689.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_lavc.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c
index be7de127f4..4b69231bfd 100644
--- a/video/out/vo_lavc.c
+++ b/video/out/vo_lavc.c
@@ -49,7 +49,6 @@ struct priv {
int64_t mindeltapts;
double expected_next_pts;
mp_image_t *lastimg;
- int lastimg_wants_osd;
int lastdisplaycount;
AVRational worst_time_base;
@@ -287,6 +286,14 @@ static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi)
double pts = mpi ? mpi->pts : MP_NOPTS_VALUE;
+ if (mpi) {
+ assert(vo->params);
+
+ struct mp_osd_res dim = osd_res_from_image_params(vo->params);
+
+ osd_draw_on_image(vo->osd, dim, mpi->pts, OSD_DRAW_SUB_ONLY, mpi);
+ }
+
if (!vc || vc->shutdown)
goto done;
if (!encode_lavc_start(ectx)) {
@@ -451,7 +458,6 @@ static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi)
talloc_free(vc->lastimg);
vc->lastimg = mpi;
mpi = NULL;
- vc->lastimg_wants_osd = true;
vc->lastframeipts = vc->lastipts = frameipts;
if (ectx->options->rawts && vc->lastipts < 0) {
@@ -462,17 +468,9 @@ static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi)
} else {
MP_INFO(vo, "Frame at pts %d got dropped "
"entirely because pts went backwards\n", (int) frameipts);
- vc->lastimg_wants_osd = false;
}
}
- if (vc->lastimg && vc->lastimg_wants_osd && vo->params) {
- struct mp_osd_res dim = osd_res_from_image_params(vo->params);
-
- osd_draw_on_image(vo->osd, dim, vc->lastimg->pts, OSD_DRAW_SUB_ONLY,
- vc->lastimg);
- }
-
done:
talloc_free(mpi);
}