decoder/sndfile: allow partial reads at end of file
While libsndfile doesn't like partial reads in the middle of a file (see commit95ac6071b9
), it allows partial reads at the end of a file. It doesn't pay attention to the file size when issuing a read. Commitecb67a1ed1
(MPD 0.18.12) was a regression: previously, partial reads at the end of a file were possible, but switching to decoder_read_full() made this an error condition. This way, a portion at the end of each file was lost, leading to corruption with gapless playback (https://github.com/MusicPlayerDaemon/MPD/issues/936). This fix switches to the newly introduced function decoder_read_much(), which does the same as the code before commitecb67a1ed1
. Closes https://github.com/MusicPlayerDaemon/MPD/issues/936
This commit is contained in:
parent
33f70931dd
commit
0aa0ffb67b
2
NEWS
2
NEWS
@ -2,6 +2,8 @@ ver 0.21.26 (not yet released)
|
|||||||
* output
|
* output
|
||||||
- osx: fix crash bug
|
- osx: fix crash bug
|
||||||
- sles: support floating point samples
|
- sles: support floating point samples
|
||||||
|
* decoder
|
||||||
|
- sndfile: fix lost samples at end of file
|
||||||
|
|
||||||
ver 0.21.25 (2020/07/06)
|
ver 0.21.25 (2020/07/06)
|
||||||
* protocol:
|
* protocol:
|
||||||
|
@ -46,9 +46,7 @@ struct SndfileInputStream {
|
|||||||
size_t Read(void *buffer, size_t size) {
|
size_t Read(void *buffer, size_t size) {
|
||||||
/* libsndfile chokes on partial reads; therefore
|
/* libsndfile chokes on partial reads; therefore
|
||||||
always force full reads */
|
always force full reads */
|
||||||
return decoder_read_full(client, is, buffer, size)
|
return decoder_read_much(client, is, buffer, size);
|
||||||
? size
|
|
||||||
: 0;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user