diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:10 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:10 +0200 |
commit | a3cc928c711f78366eba0a009115ffa0982102ff (patch) | |
tree | 748064d0c09ff81e33f49e4cc627b9bc837fdafa /src/inputPlugins/aac_plugin.c | |
parent | 35858dfe3a2bac326f91e558cbdc31d05c47615e (diff) | |
download | mpd-a3cc928c711f78366eba0a009115ffa0982102ff.tar.gz mpd-a3cc928c711f78366eba0a009115ffa0982102ff.tar.xz mpd-a3cc928c711f78366eba0a009115ffa0982102ff.zip |
aac: use inputStreamAtEOF()
When checking for EOF, we should not check whether the read request
has been fully satisified. The InputStream API does not guarantee
that readFromInputStream() always fills the whole buffer, if EOF is
not reached. Since there is the function inputStreamAtEOF() dedicated
for this purpose, we should use it for EOF checking after
readFromInputStream()==0.
Diffstat (limited to 'src/inputPlugins/aac_plugin.c')
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 4b1cba6e3..55c211c70 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -62,7 +62,7 @@ static void fillAacBuffer(AacBuffer * b) b-> bytesIntoBuffer), 1, rest); - if (bread != rest) + if (bread == 0 && inputStreamAtEOF(b->inStream)) b->atEof = 1; b->bytesIntoBuffer += bread; } @@ -150,7 +150,7 @@ static void initAacBuffer(InputStream * inStream, AacBuffer * b, float *length) b->bytesConsumed = 0; b->fileOffset = 0; - if (bread != FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS) + if (bread == 0 && inputStreamAtEOF(inStream)) b->atEof = 1; tagsize = 0; @@ -173,10 +173,9 @@ static void initAacBuffer(InputStream * inStream, AacBuffer * b, float *length) bread = readFromInputStream(b->inStream, b->buffer, 1, FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS); - if (bread != FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS) + if (bread == 0 && inputStreamAtEOF(inStream)) b->atEof = 1; - else - b->atEof = 0; + b->bytesIntoBuffer = bread; b->bytesConsumed = 0; b->fileOffset = tagsize; |