omfg
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9173 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
948557162f
commit
03cc800f0c
|
@ -985,12 +985,15 @@ static int III_dequantize_sample(struct mpstr *mp, real xr[SBLIMIT][SSLIMIT], in
|
||||||
getbits(mp, 16); /* Dismiss stuffing Bits */
|
getbits(mp, 16); /* Dismiss stuffing Bits */
|
||||||
part2remain -= 16;
|
part2remain -= 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part2remain > 0)
|
if (part2remain > 0)
|
||||||
getbits(mp, part2remain);
|
getbits(mp, part2remain);
|
||||||
|
#if 0
|
||||||
else if (part2remain < 0) {
|
else if (part2remain < 0) {
|
||||||
debug_printf("mpg123: %d Can't rewind stream by %d bits!\n", -part2remain, __LINE__);
|
debug_printf("mpg123: %d Can't rewind stream by %d bits!\n", -part2remain, __LINE__);
|
||||||
return 1; /* -> error */
|
return 1; /* -> error */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ struct shout_context {
|
||||||
uint8_t shout_init;
|
uint8_t shout_init;
|
||||||
uint32_t prebuf;
|
uint32_t prebuf;
|
||||||
int lame_ready;
|
int lame_ready;
|
||||||
|
int eof;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct shout_context shout_context_t;
|
typedef struct shout_context shout_context_t;
|
||||||
|
@ -233,10 +234,11 @@ static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
|
||||||
size_t lp;
|
size_t lp;
|
||||||
size_t rb = 0;
|
size_t rb = 0;
|
||||||
|
|
||||||
while (switch_buffer_inuse(context->audio_buffer) < bytes) {
|
while (!context->eof && switch_buffer_inuse(context->audio_buffer) < bytes) {
|
||||||
lp = sizeof(inbuf);
|
lp = sizeof(inbuf);
|
||||||
if ((switch_file_read(context->fd, inbuf, &lp) != SWITCH_STATUS_SUCCESS) || lp == 0) {
|
if ((switch_file_read(context->fd, inbuf, &lp) != SWITCH_STATUS_SUCCESS) || lp == 0) {
|
||||||
goto error;
|
context->eof++;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
inlen = (int) lp;
|
inlen = (int) lp;
|
||||||
|
@ -274,17 +276,15 @@ static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
|
||||||
out = context->decode_buf;
|
out = context->decode_buf;
|
||||||
outlen = sizeof(context->decode_buf);
|
outlen = sizeof(context->decode_buf);
|
||||||
usedlen = 0;
|
usedlen = 0;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
} else if (decode_status == MP3_ERR) {
|
||||||
|
|
||||||
if (decode_status == MP3_ERR) {
|
|
||||||
if (++context->mp3err >= 5) {
|
if (++context->mp3err >= 5) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
|
||||||
goto error;
|
context->eof++;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlen = 0;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,16 +309,20 @@ static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
|
||||||
used = switch_buffer_inuse(context->audio_buffer);
|
used = switch_buffer_inuse(context->audio_buffer);
|
||||||
|
|
||||||
if (done || used >= bytes) {
|
if (context->eof || done || used >= bytes) {
|
||||||
rb = switch_buffer_read(context->audio_buffer, data, used);
|
if (!(rb = switch_buffer_read(context->audio_buffer, data, bytes))) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
return rb;
|
return rb;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
switch_mutex_lock(context->audio_mutex);
|
switch_mutex_lock(context->audio_mutex);
|
||||||
context->err++;
|
context->err++;
|
||||||
switch_mutex_unlock(context->audio_mutex);
|
switch_mutex_unlock(context->audio_mutex);
|
||||||
|
|
Loading…
Reference in New Issue