diff options
-rw-r--r-- | plugins/ffap/ffap.c | 12 | ||||
-rw-r--r-- | plugins/nullout/nullout.c | 8 | ||||
-rw-r--r-- | streamer.c | 1 |
3 files changed, 16 insertions, 5 deletions
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c index 8db1ad56..48318f9d 100644 --- a/plugins/ffap/ffap.c +++ b/plugins/ffap/ffap.c @@ -41,6 +41,9 @@ //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(fmt,...) +#define likely(x) __builtin_expect((x),1) +#define unlikely(x) __builtin_expect((x),0) + static DB_decoder_t plugin; static DB_functions_t *deadbeef; @@ -914,7 +917,14 @@ static inline int ape_decode_value(APEContext * ctx, APERice *rice) overflow |= range_decode_bits(ctx, 16); } - base = range_decode_culfreq(ctx, pivot); +// base = range_decode_culfreq(ctx, pivot); + range_dec_normalize(ctx); + ctx->rc.help = ctx->rc.range / pivot; + if (unlikely (ctx->rc.help == 0)) { + ctx->error = 1; + return 0; + } + base = ctx->rc.low / ctx->rc.help; range_decode_update(ctx, 1, base); x = base + overflow * pivot; diff --git a/plugins/nullout/nullout.c b/plugins/nullout/nullout.c index 57980d60..ef14e367 100644 --- a/plugins/nullout/nullout.c +++ b/plugins/nullout/nullout.c @@ -19,6 +19,7 @@ #include <unistd.h> #include <sys/prctl.h> #include <stdio.h> +#include <string.h> #include "deadbeef.h" #define trace(...) { fprintf(stderr, __VA_ARGS__); } @@ -97,10 +98,8 @@ pnull_change_rate (int rate) { int pnull_free (void) { - trace ("pnull_free\n"); if (!null_terminate) { null_terminate = 1; - deadbeef->thread_join (null_tid); null_tid = 0; state = OUTPUT_STATE_STOPPED; null_terminate = 0; @@ -110,6 +109,9 @@ pnull_free (void) { int pnull_play (void) { + if (!null_tid) { + pnull_init (); + } state = OUTPUT_STATE_PLAYING; return 0; } @@ -188,10 +190,8 @@ pnull_thread (void *context) { continue; } - char buf[4096]; pnull_callback (buf, 1024); - usleep (1000); // this must be here to prevent mutex deadlock } } @@ -447,6 +447,7 @@ streamer_thread (void *ctx) { alloc_time -= ms; if (alloc_time > 0) { usleep (alloc_time * 1000); +// usleep (1000); } // trace ("fill: %d/%d\n", streambuffer_fill, STREAM_BUFFER_SIZE); } |