diff options
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-device.c | 25 | ||||
-rw-r--r-- | src/modules/bluetooth/sbc.c | 18 | ||||
-rw-r--r-- | src/modules/bluetooth/sbc.h | 1 | ||||
-rw-r--r-- | src/modules/bluetooth/sbc_primitives.c | 1 | ||||
-rw-r--r-- | src/modules/bluetooth/sbc_primitives.h | 1 | ||||
-rw-r--r-- | src/modules/bluetooth/sbc_primitives_mmx.c | 1 | ||||
-rw-r--r-- | src/modules/bluetooth/sbc_primitives_neon.c | 1 |
7 files changed, 36 insertions, 12 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 6daae83c..b8f67299 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -904,6 +904,11 @@ static int a2dp_process_render(struct userdata *u) { (void*) p, u->write_memchunk.length, d, left, &written); + + PA_ONCE_BEGIN { + pa_log_debug("Using SBC encoder implementation: %s", pa_strnull(sbc_get_implementation_info(&a2dp->sbc))); + } PA_ONCE_END; + pa_memblock_release(u->write_memchunk.memblock); if (encoded <= 0) { @@ -1349,9 +1354,6 @@ static int add_sink(struct userdata *u) { u->sink->userdata = u; u->sink->parent.process_msg = sink_process_msg; - - pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); - pa_sink_set_rtpoll(u->sink, u->rtpoll); } /* u->sink->get_volume = sink_get_volume_cb; */ @@ -1396,9 +1398,6 @@ static int add_source(struct userdata *u) { u->source->userdata = u; u->source->parent.process_msg = source_process_msg; - - pa_source_set_asyncmsgq(u->source, u->thread_mq.inq); - pa_source_set_rtpoll(u->source, u->rtpoll); } /* u->source->get_volume = source_get_volume_cb; */ @@ -1523,9 +1522,9 @@ static void stop_thread(struct userdata *u) { u->source = NULL; } - pa_thread_mq_done(&u->thread_mq); - if (u->rtpoll) { + pa_thread_mq_done(&u->thread_mq); + pa_rtpoll_free(u->rtpoll); u->rtpoll = NULL; } @@ -1559,11 +1558,17 @@ static int start_thread(struct userdata *u) { return -1; } - if (u->sink) + if (u->sink) { + pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); + pa_sink_set_rtpoll(u->sink, u->rtpoll); pa_sink_put(u->sink); + } - if (u->source) + if (u->source) { + pa_source_set_asyncmsgq(u->source, u->thread_mq.inq); + pa_source_set_rtpoll(u->source, u->rtpoll); pa_source_put(u->source); + } return 0; } diff --git a/src/modules/bluetooth/sbc.c b/src/modules/bluetooth/sbc.c index 29258d05..a33ed571 100644 --- a/src/modules/bluetooth/sbc.c +++ b/src/modules/bluetooth/sbc.c @@ -985,7 +985,7 @@ int sbc_decode(sbc_t *sbc, void *input, int input_len, void *output, char *ptr; int i, ch, framelen, samples; - if (!sbc && !input) + if (!sbc || !input) return -EIO; priv = sbc->priv; @@ -1053,7 +1053,7 @@ int sbc_encode(sbc_t *sbc, void *input, int input_len, void *output, const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], int nsamples, int nchannels); - if (!sbc && !input) + if (!sbc || !input) return -EIO; priv = sbc->priv; @@ -1221,6 +1221,20 @@ uint16_t sbc_get_codesize(sbc_t *sbc) return subbands * blocks * channels * 2; } +const char *sbc_get_implementation_info(sbc_t *sbc) +{ + struct sbc_priv *priv; + + if (!sbc) + return NULL; + + priv = sbc->priv; + if (!priv) + return NULL; + + return priv->enc_state.implementation_info; +} + int sbc_reinit(sbc_t *sbc, unsigned long flags) { struct sbc_priv *priv; diff --git a/src/modules/bluetooth/sbc.h b/src/modules/bluetooth/sbc.h index b0a14888..f9d506bc 100644 --- a/src/modules/bluetooth/sbc.h +++ b/src/modules/bluetooth/sbc.h @@ -89,6 +89,7 @@ int sbc_encode(sbc_t *sbc, void *input, int input_len, void *output, int sbc_get_frame_length(sbc_t *sbc); int sbc_get_frame_duration(sbc_t *sbc); uint16_t sbc_get_codesize(sbc_t *sbc); +const char *sbc_get_implementation_info(sbc_t *sbc); void sbc_finish(sbc_t *sbc); #ifdef __cplusplus diff --git a/src/modules/bluetooth/sbc_primitives.c b/src/modules/bluetooth/sbc_primitives.c index 303f3fee..6b0be3f5 100644 --- a/src/modules/bluetooth/sbc_primitives.c +++ b/src/modules/bluetooth/sbc_primitives.c @@ -456,6 +456,7 @@ void sbc_init_primitives(struct sbc_encoder_state *state) /* Default implementation for scale factors calculation */ state->sbc_calc_scalefactors = sbc_calc_scalefactors; + state->implementation_info = "Generic C"; /* X86/AMD64 optimizations */ #ifdef SBC_BUILD_WITH_MMX_SUPPORT diff --git a/src/modules/bluetooth/sbc_primitives.h b/src/modules/bluetooth/sbc_primitives.h index 2708c829..3d01c115 100644 --- a/src/modules/bluetooth/sbc_primitives.h +++ b/src/modules/bluetooth/sbc_primitives.h @@ -62,6 +62,7 @@ struct sbc_encoder_state { void (*sbc_calc_scalefactors)(int32_t sb_sample_f[16][2][8], uint32_t scale_factor[2][8], int blocks, int channels, int subbands); + const char *implementation_info; }; /* diff --git a/src/modules/bluetooth/sbc_primitives_mmx.c b/src/modules/bluetooth/sbc_primitives_mmx.c index 1870a9ba..08e9ca28 100644 --- a/src/modules/bluetooth/sbc_primitives_mmx.c +++ b/src/modules/bluetooth/sbc_primitives_mmx.c @@ -313,6 +313,7 @@ void sbc_init_primitives_mmx(struct sbc_encoder_state *state) if (check_mmx_support()) { state->sbc_analyze_4b_4s = sbc_analyze_4b_4s_mmx; state->sbc_analyze_4b_8s = sbc_analyze_4b_8s_mmx; + state->implementation_info = "MMX"; } } diff --git a/src/modules/bluetooth/sbc_primitives_neon.c b/src/modules/bluetooth/sbc_primitives_neon.c index d9c12f9e..f1bc7b48 100644 --- a/src/modules/bluetooth/sbc_primitives_neon.c +++ b/src/modules/bluetooth/sbc_primitives_neon.c @@ -240,6 +240,7 @@ void sbc_init_primitives_neon(struct sbc_encoder_state *state) { state->sbc_analyze_4b_4s = sbc_analyze_4b_4s_neon; state->sbc_analyze_4b_8s = sbc_analyze_4b_8s_neon; + state->implementation_info = "NEON"; } #endif |