Commit 0d0bf563 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed crash + improved logs

parent c02d1474
...@@ -115,7 +115,7 @@ static void android_snd_card_device_create(JNIEnv *env, jobject deviceInfo, MSSn ...@@ -115,7 +115,7 @@ static void android_snd_card_device_create(JNIEnv *env, jobject deviceInfo, MSSn
card=ms_snd_card_ref(card); card=ms_snd_card_ref(card);
ms_snd_card_manager_prepend_card(m, card); ms_snd_card_manager_prepend_card(m, card);
ms_message("[AAudio] Added card: id %s name %s device ID %0d device_type %s capabilities 0'h%0X ", card->id, card->name, card->internal_id, ms_snd_card_device_type_to_string(card->device_type), card->capabilities); ms_message("[AAudio] Added card with ID: [%s], name: [%s], device ID: [%0d], type: [%s] and capabilities: [%0d]", card->id, card->name, card->internal_id, ms_snd_card_device_type_to_string(card->device_type), card->capabilities);
} else { } else {
free(card); free(card);
} }
......
...@@ -175,6 +175,7 @@ static void aaudio_player_init(AAudioOutputContext *octx) { ...@@ -175,6 +175,7 @@ static void aaudio_player_init(AAudioOutputContext *octx) {
octx->updateStreamTypeFromMsSndCard(); octx->updateStreamTypeFromMsSndCard();
AAudioStreamBuilder_setDeviceId(builder, octx->soundCard->internal_id); AAudioStreamBuilder_setDeviceId(builder, octx->soundCard->internal_id);
ms_message("[AAudio] Using device ID: %s (%i)", octx->soundCard->id, octx->soundCard->internal_id);
AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_OUTPUT); AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_OUTPUT);
AAudioStreamBuilder_setSampleRate(builder, octx->aaudio_context->samplerate); AAudioStreamBuilder_setSampleRate(builder, octx->aaudio_context->samplerate);
AAudioStreamBuilder_setDataCallback(builder, aaudio_player_callback, octx); AAudioStreamBuilder_setDataCallback(builder, aaudio_player_callback, octx);
......
...@@ -84,7 +84,9 @@ static aaudio_data_callback_result_t aaudio_recorder_callback(AAudioStream *stre ...@@ -84,7 +84,9 @@ static aaudio_data_callback_result_t aaudio_recorder_callback(AAudioStream *stre
m->b_wptr += bufferSize; m->b_wptr += bufferSize;
ms_mutex_lock(&ictx->mutex); ms_mutex_lock(&ictx->mutex);
ictx->mAvSkew = ms_ticker_synchronizer_update(ictx->mTickerSynchronizer, ictx->read_samples, (unsigned int)ictx->aaudio_context->samplerate); if (ictx->mTickerSynchronizer != NULL) {
ictx->mAvSkew = ms_ticker_synchronizer_update(ictx->mTickerSynchronizer, ictx->read_samples, (unsigned int)ictx->aaudio_context->samplerate);
}
putq(&ictx->q, m); putq(&ictx->q, m);
ms_mutex_unlock(&ictx->mutex); ms_mutex_unlock(&ictx->mutex);
...@@ -100,9 +102,9 @@ static void aaudio_recorder_init(AAudioInputContext *ictx) { ...@@ -100,9 +102,9 @@ static void aaudio_recorder_init(AAudioInputContext *ictx) {
ms_error("[AAudio] Couldn't create stream builder for recorder: %i / %s", result, AAudio_convertResultToText(result)); ms_error("[AAudio] Couldn't create stream builder for recorder: %i / %s", result, AAudio_convertResultToText(result));
} }
ms_message("[AAudio] DEBUG Creating input stream for device ID %0d", ictx->soundCard->internal_id);
AAudioStreamBuilder_setDeviceId(builder, ictx->soundCard->internal_id); AAudioStreamBuilder_setDeviceId(builder, ictx->soundCard->internal_id);
ms_message("[AAudio] Using device ID: %s (%i)", ictx->soundCard->id, ictx->soundCard->internal_id);
AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_INPUT); AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_INPUT);
AAudioStreamBuilder_setSampleRate(builder, ictx->aaudio_context->samplerate); AAudioStreamBuilder_setSampleRate(builder, ictx->aaudio_context->samplerate);
AAudioStreamBuilder_setDataCallback(builder, aaudio_recorder_callback, ictx); AAudioStreamBuilder_setDataCallback(builder, aaudio_recorder_callback, ictx);
...@@ -378,7 +380,6 @@ static MSFilter* ms_android_snd_read_new(MSFactory *factory) { ...@@ -378,7 +380,6 @@ static MSFilter* ms_android_snd_read_new(MSFactory *factory) {
MSFilter *android_snd_card_create_reader(MSSndCard *card) { MSFilter *android_snd_card_create_reader(MSSndCard *card) {
ms_message("[AAudio] DEBUG Setting capture card to: id %s name %s device ID %0d device_type %s capabilities 0'h%0X", card->id, card->name, card->internal_id, ms_snd_card_device_type_to_string(card->device_type), card->capabilities);
MSFilter *f = ms_android_snd_read_new(ms_snd_card_get_factory(card)); MSFilter *f = ms_android_snd_read_new(ms_snd_card_get_factory(card));
AAudioInputContext *ictx = static_cast<AAudioInputContext*>(f->data); AAudioInputContext *ictx = static_cast<AAudioInputContext*>(f->data);
ictx->soundCard = ms_snd_card_ref(card); ictx->soundCard = ms_snd_card_ref(card);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment