summaryrefslogtreecommitdiff
path: root/community/mpv/mpv-0.3.1-always_respect_sector_size.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/mpv/mpv-0.3.1-always_respect_sector_size.patch')
-rw-r--r--community/mpv/mpv-0.3.1-always_respect_sector_size.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/community/mpv/mpv-0.3.1-always_respect_sector_size.patch b/community/mpv/mpv-0.3.1-always_respect_sector_size.patch
new file mode 100644
index 000000000..82c474081
--- /dev/null
+++ b/community/mpv/mpv-0.3.1-always_respect_sector_size.patch
@@ -0,0 +1,34 @@
+From b04b48fc10dabb1d1b26ff519f55dcafb320985e Mon Sep 17 00:00:00 2001
+From: wm4 <wm4@nowhere>
+Date: Thu, 2 Jan 2014 00:39:14 +0100
+Subject: [PATCH] stream: always respect sector_size, fixes cdda://
+
+Streams like CDDA have special requirements in what quantities data can
+be read: you can only read a sector at once, not more and not less. The
+stream_peek() function didn't respect that and set less (used internal
+buffer size of 2048 bytes, instead of CD sector size of 2352 bytes), so
+no data was read and EOF was accidentally set, making playback with
+cdda:// fail.
+
+This is a regression since commit 9a723f, but that commit merely exposed
+the issue (the redundant seek would clear the EOF flag).
+---
+ stream/stream.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/stream/stream.c b/stream/stream.c
+index 3332e66..b48de57 100644
+--- a/stream/stream.c
++++ b/stream/stream.c
+@@ -562,7 +562,7 @@ struct bstr stream_peek(stream_t *s, int len)
+ while (buf_valid < len) {
+ int chunk = MPMAX(len - buf_valid, STREAM_BUFFER_SIZE);
+ if (s->sector_size)
+- chunk = STREAM_BUFFER_SIZE;
++ chunk = s->sector_size;
+ assert(buf_valid + chunk <= TOTAL_BUFFER_SIZE);
+ int read = stream_read_unbuffered(s, &s->buffer[buf_valid], chunk);
+ if (read == 0)
+--
+1.8.5.1
+