diff options
| -rw-r--r-- | src/qmmp/decoder.cpp | 2 | ||||
| -rw-r--r-- | src/qmmp/output.cpp | 2 | ||||
| -rw-r--r-- | src/qmmp/recycler.cpp | 14 |
3 files changed, 4 insertions, 14 deletions
diff --git a/src/qmmp/decoder.cpp b/src/qmmp/decoder.cpp index 344154164..d555348cb 100644 --- a/src/qmmp/decoder.cpp +++ b/src/qmmp/decoder.cpp @@ -171,7 +171,7 @@ qint64 Decoder::produceSound(char *data, qint64 size, quint32 brate, int chan) if (w < blksize + b->exceeding) memset(b->data + w, 0, blksize + b->exceeding - w); - b->nbytes = w;// blksize; + b->nbytes = w; b->rate = brate; output()->recycler()->add(); diff --git a/src/qmmp/output.cpp b/src/qmmp/output.cpp index 77a28a39a..61c9658e9 100644 --- a/src/qmmp/output.cpp +++ b/src/qmmp/output.cpp @@ -190,7 +190,7 @@ void Output::run() dispatchVisual(b, m_totalWritten, m_channels, m_precision); changeVolume(b->data, b->nbytes, m_channels); if ((l = writeAudio(b->data, b->nbytes)) > 0) - m_totalWritten += b->nbytes; + m_totalWritten += l; else break; } diff --git a/src/qmmp/recycler.cpp b/src/qmmp/recycler.cpp index 67d4e4f7e..e718d9c46 100644 --- a/src/qmmp/recycler.cpp +++ b/src/qmmp/recycler.cpp @@ -12,7 +12,7 @@ Recycler::Recycler ( unsigned int sz ) : add_index ( 0 ), done_index ( 0 ), current_count ( 0 ) { - buffer_count = ( sz / Buffer::size() ); + buffer_count = sz / Buffer::size(); if (buffer_count < 4) { buffer_count = 4; @@ -87,7 +87,7 @@ void Recycler::add() Buffer *Recycler::next() { - return buffers[done_index]; + return empty() ? 0 : buffers[done_index]; } @@ -102,16 +102,6 @@ void Recycler::done() void Recycler::clear() { add_index = done_index = current_count = 0; - /*for ( unsigned int i = 0; i < buffer_count; i ++ ) - { - if(buffers[i]->exceeding > 0) - { - delete buffers[i]->data; - buffers[i]->data = new unsigned char[Buffer::size()]; - buffers[i]->exceeding = 0; - buffers[i]->nbytes = 0; - } - }*/ } |
