summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-02 00:39:14 +0100
committerwm4 <wm4@nowhere>2014-01-06 20:20:48 +0100
commitb56f61d2abe69aa426252af0343fac1dd6d68f7e (patch)
treec894e9c2b272d7e795ae6f730d035fa671f83fb3
parent82ab3a8160d88ca57522777452eff322274965c7 (diff)
downloadmpv-b56f61d2abe69aa426252af0343fac1dd6d68f7e.tar.bz2
mpv-b56f61d2abe69aa426252af0343fac1dd6d68f7e.tar.xz
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).
-rw-r--r--stream/stream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 3332e66ace..b48de575ea 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)