From ca75fedaf4dea19986159f1caa5ab9ebc202f9d4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 7 Nov 2019 15:37:18 +0100 Subject: [PATCH] stream_dvdnav: ok, this makes no sense at all The dvdnav API reads in 2K blocks (dvdnav_get_next_block()). The mpv wrapper (fill_buffer() in this file) expects that the read size done by the mpv core is at least 2K for this reason. If not, it returns an error. This used to be OK, because there was a thing called section alignment in the core code. This was removed because the core shouldn't suffer from optical disc idiosyncrasies. Which means that ever since, it has been working only by coincidence, or maybe not at all. Fixing this would require keeping a buffer in the priv struct, and returning it piece by piece if the core makes smaller reads. I have no intention of writing such code, so add an error message asking for a patch. If anyone actually cares about DVD, maybe it'll get fixed. --- stream/stream_dvdnav.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index d5090cfa69..a042508c2a 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -262,8 +262,11 @@ static int fill_buffer(stream_t *s, void *buf, int max_len) struct priv *priv = s->priv; dvdnav_t *dvdnav = priv->dvdnav; - if (max_len < 2048) + if (max_len < 2048) { + MP_FATAL(s, "Short read size. Data corruption will follow. Please " + "provide a patch.\n"); return -1; + } while (1) { int len = -1;