added outputBufferShift()
Hiding OutputBuffer internals, yet again. Two more assertions. git-svn-id: https://svn.musicpd.org/mpd/trunk@7274 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
11a5728e1d
commit
2e648b57f3
@ -557,10 +557,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
break;
|
break;
|
||||||
pc->totalPlayTime +=
|
pc->totalPlayTime +=
|
||||||
sizeToTime * beginChunk->chunkSize;
|
sizeToTime * beginChunk->chunkSize;
|
||||||
if ((unsigned)cb->begin + 1 >= buffered_chunks) {
|
outputBufferShift(cb);
|
||||||
cb->begin = 0;
|
|
||||||
} else
|
|
||||||
cb->begin++;
|
|
||||||
player_wakeup_decoder_nb();
|
player_wakeup_decoder_nb();
|
||||||
} else if (!outputBufferEmpty(cb) && cb->begin == next) {
|
} else if (!outputBufferEmpty(cb) && cb->begin == next) {
|
||||||
/* at the beginning of a new song */
|
/* at the beginning of a new song */
|
||||||
|
@ -56,6 +56,16 @@ int outputBufferEmpty(const OutputBuffer * cb)
|
|||||||
return cb->begin == cb->end;
|
return cb->begin == cb->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void outputBufferShift(OutputBuffer * cb)
|
||||||
|
{
|
||||||
|
assert(cb->begin != cb->end);
|
||||||
|
assert(cb->begin < buffered_chunks);
|
||||||
|
|
||||||
|
++cb->begin;
|
||||||
|
if (cb->begin >= buffered_chunks)
|
||||||
|
cb->begin = 0;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int outputBufferRelative(const OutputBuffer * cb, unsigned i)
|
unsigned int outputBufferRelative(const OutputBuffer * cb, unsigned i)
|
||||||
{
|
{
|
||||||
if (i >= cb->begin)
|
if (i >= cb->begin)
|
||||||
|
@ -65,6 +65,8 @@ void flushOutputBuffer(OutputBuffer * cb);
|
|||||||
/** is the buffer empty? */
|
/** is the buffer empty? */
|
||||||
int outputBufferEmpty(const OutputBuffer * cb);
|
int outputBufferEmpty(const OutputBuffer * cb);
|
||||||
|
|
||||||
|
void outputBufferShift(OutputBuffer * cb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* what is the position of the specified chunk number, relative to
|
* what is the position of the specified chunk number, relative to
|
||||||
* the first chunk in use?
|
* the first chunk in use?
|
||||||
|
Loading…
Reference in New Issue
Block a user