do not reset nextChunk
The variables "nextChunk" and "crossFadeChunks" are only used when doCrossFade==1. This means that we do not have to reset these as long as doCrossFade!=1. git-svn-id: https://svn.musicpd.org/mpd/trunk@7265 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:

committed by
Eric Wong

parent
4e60343e55
commit
e9b7aae3f0
14
src/decode.c
14
src/decode.c
@@ -157,7 +157,6 @@ static void processDecodeInput(PlayerControl * pc, DecoderControl * dc,
|
|||||||
OutputBuffer * cb,
|
OutputBuffer * cb,
|
||||||
int *pause_r, unsigned int *bbp_r,
|
int *pause_r, unsigned int *bbp_r,
|
||||||
int *doCrossFade_r,
|
int *doCrossFade_r,
|
||||||
int *nextChunk_r,
|
|
||||||
int *decodeWaitedOn_r,
|
int *decodeWaitedOn_r,
|
||||||
int *next_r)
|
int *next_r)
|
||||||
{
|
{
|
||||||
@@ -201,7 +200,6 @@ static void processDecodeInput(PlayerControl * pc, DecoderControl * dc,
|
|||||||
dropBufferedAudio();
|
dropBufferedAudio();
|
||||||
if(decodeSeek(pc,dc,cb,decodeWaitedOn_r,next_r) == 0) {
|
if(decodeSeek(pc,dc,cb,decodeWaitedOn_r,next_r) == 0) {
|
||||||
*doCrossFade_r = 0;
|
*doCrossFade_r = 0;
|
||||||
*nextChunk_r = -1;
|
|
||||||
*bbp_r = 0;
|
*bbp_r = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,10 +368,10 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
/** cross fading enabled for the current song? 0=must check;
|
/** cross fading enabled for the current song? 0=must check;
|
||||||
1=enabled; -1=disabled */
|
1=enabled; -1=disabled */
|
||||||
int doCrossFade = 0;
|
int doCrossFade = 0;
|
||||||
unsigned int crossFadeChunks = 0;
|
unsigned int crossFadeChunks;
|
||||||
/** the position of the next cross-faded chunk in the next
|
/** the position of the next cross-faded chunk in the next
|
||||||
song */
|
song */
|
||||||
int nextChunk = -1;
|
int nextChunk;
|
||||||
int decodeWaitedOn = 0;
|
int decodeWaitedOn = 0;
|
||||||
static const char silence[CHUNK_SIZE];
|
static const char silence[CHUNK_SIZE];
|
||||||
double sizeToTime = 0.0;
|
double sizeToTime = 0.0;
|
||||||
@@ -392,7 +390,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
while (!quit) {
|
while (!quit) {
|
||||||
processDecodeInput(pc, dc, cb,
|
processDecodeInput(pc, dc, cb,
|
||||||
&pause, &bbp, &doCrossFade,
|
&pause, &bbp, &doCrossFade,
|
||||||
&nextChunk, &decodeWaitedOn, &next);
|
&decodeWaitedOn, &next);
|
||||||
if (pc->stop) {
|
if (pc->stop) {
|
||||||
dropBufferedAudio();
|
dropBufferedAudio();
|
||||||
quitDecode(pc,dc);
|
quitDecode(pc,dc);
|
||||||
@@ -469,9 +467,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
/* enable cross fading in this song? if yes,
|
/* enable cross fading in this song? if yes,
|
||||||
calculate how many chunks will be required
|
calculate how many chunks will be required
|
||||||
for it */
|
for it */
|
||||||
nextChunk = -1;
|
|
||||||
if (isCurrentAudioFormat(&(cb->audioFormat))) {
|
if (isCurrentAudioFormat(&(cb->audioFormat))) {
|
||||||
doCrossFade = 1;
|
doCrossFade = 1;
|
||||||
|
nextChunk = -1;
|
||||||
crossFadeChunks =
|
crossFadeChunks =
|
||||||
calculateCrossFadeChunks(pc,
|
calculateCrossFadeChunks(pc,
|
||||||
&(cb->
|
&(cb->
|
||||||
@@ -575,7 +573,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
pc->queueLockState == PLAYER_QUEUE_LOCKED) {
|
pc->queueLockState == PLAYER_QUEUE_LOCKED) {
|
||||||
processDecodeInput(pc, dc, cb,
|
processDecodeInput(pc, dc, cb,
|
||||||
&pause, &bbp, &doCrossFade,
|
&pause, &bbp, &doCrossFade,
|
||||||
&nextChunk, &decodeWaitedOn,
|
&decodeWaitedOn,
|
||||||
&next);
|
&next);
|
||||||
if (pc->stop) {
|
if (pc->stop) {
|
||||||
dropBufferedAudio();
|
dropBufferedAudio();
|
||||||
@@ -592,9 +590,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
|||||||
if (waitOnDecode(pc, dc, cb, &decodeWaitedOn) < 0)
|
if (waitOnDecode(pc, dc, cb, &decodeWaitedOn) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nextChunk = -1;
|
|
||||||
doCrossFade = 0;
|
doCrossFade = 0;
|
||||||
crossFadeChunks = 0;
|
|
||||||
pc->queueState = PLAYER_QUEUE_EMPTY;
|
pc->queueState = PLAYER_QUEUE_EMPTY;
|
||||||
wakeup_main_task();
|
wakeup_main_task();
|
||||||
} else if (dc->state == DECODE_STATE_STOP && !dc->start) {
|
} else if (dc->state == DECODE_STATE_STOP && !dc->start) {
|
||||||
|
Reference in New Issue
Block a user