Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
msaaudio
Commits
1c4f9008
Commit
1c4f9008
authored
Jul 15, 2020
by
Andrea Gianarda
Browse files
Do not ref card before prepending it as prepend function already takes a ref
Take into account ms2 mandroid specific method name change
parent
4188c280
Changes
3
Hide whitespace changes
Inline
Side-by-side
msaaudio.cpp
View file @
1c4f9008
...
...
@@ -36,7 +36,7 @@ static void android_snd_card_detect(MSSndCardManager *m) {
JNIEnv
*
env
=
ms_get_jni_env
();
// Get all devices
jobject
devices
=
get_all_devices
(
env
,
"all"
);
jobject
devices
=
ms_android_
get_all_devices
(
env
,
"all"
);
// extract required information from every device
jobjectArray
deviceArray
=
(
jobjectArray
)
devices
;
...
...
@@ -77,7 +77,7 @@ MSSndCardDesc android_native_snd_aaudio_card_desc = {
static
void
android_snd_card_device_create
(
JNIEnv
*
env
,
jobject
deviceInfo
,
MSSndCardManager
*
m
)
{
MSSndCardDeviceType
type
=
get_device_type
(
env
,
deviceInfo
);
MSSndCardDeviceType
type
=
ms_android_
get_device_type
(
env
,
deviceInfo
);
if
(
(
type
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
)
||
(
type
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_EARPIECE
)
||
...
...
@@ -89,15 +89,15 @@ static void android_snd_card_device_create(JNIEnv *env, jobject deviceInfo, MSSn
)
{
MSSndCard
*
card
=
ms_snd_card_new
(
&
android_native_snd_aaudio_card_desc
);
card
->
name
=
ms_strdup
(
get_device_product_name
(
env
,
deviceInfo
));
card
->
internal_id
=
get_device_id
(
env
,
deviceInfo
);
card
->
name
=
ms_strdup
(
ms_android_
get_device_product_name
(
env
,
deviceInfo
));
card
->
internal_id
=
ms_android_
get_device_id
(
env
,
deviceInfo
);
card
->
device_type
=
type
;
AAudioContext
*
card_data
=
(
AAudioContext
*
)
card
->
data
;
// Card capabilities
// Assign the value because the default value is MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK
card
->
capabilities
=
get_device_capabilities
(
env
,
deviceInfo
);
card
->
capabilities
=
ms_android_
get_device_capabilities
(
env
,
deviceInfo
);
MSDevicesInfo
*
devices
=
ms_factory_get_devices_info
(
m
->
factory
);
SoundDeviceDescription
*
d
=
ms_devices_info_get_sound_device_description
(
devices
);
if
(
d
->
flags
&
DEVICE_HAS_BUILTIN_AEC
)
{
...
...
@@ -116,6 +116,8 @@ static void android_snd_card_device_create(JNIEnv *env, jobject deviceInfo, MSSn
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
);
}
else
{
free
(
card
);
}
}
...
...
@@ -153,7 +155,7 @@ MS_PLUGIN_DECLARE(void) libmsaaudio_init(MSFactory* factory) {
ms_message
(
"[AAudio] libmsaaudio plugin loaded"
);
DeviceFavoriteSampleRate
=
get_preferred_sample_rate
();
DeviceFavoriteSampleRate
=
ms_android_
get_preferred_sample_rate
();
const
bool
loadOk
=
loadLib
();
...
...
msaaudio_player.cpp
View file @
1c4f9008
...
...
@@ -261,8 +261,8 @@ static void android_snd_write_preprocess(MSFilter *obj) {
aaudio_player_init
(
octx
);
JNIEnv
*
env
=
ms_get_jni_env
();
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
octx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
hack_volume
(
env
);
ms_android_
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
octx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
ms_android_
hack_volume
(
env
);
}
static
void
android_snd_adjust_buffer_size
(
AAudioOutputContext
*
octx
)
{
...
...
@@ -323,7 +323,7 @@ static void android_snd_write_postprocess(MSFilter *obj) {
aaudio_player_close
(
octx
);
// At the end of a call, postprocess is called therefore here the bluetooth device is disabled
JNIEnv
*
env
=
ms_get_jni_env
();
set_bt_enable
(
env
,
FALSE
);
ms_android_
set_bt_enable
(
env
,
FALSE
);
}
static
int
android_snd_write_set_device_id
(
MSFilter
*
obj
,
void
*
data
)
{
...
...
@@ -346,8 +346,8 @@ static int android_snd_write_set_device_id(MSFilter *obj, void *data) {
aaudio_player_init
(
octx
);
JNIEnv
*
env
=
ms_get_jni_env
();
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
octx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
hack_volume
(
env
);
ms_android_
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
octx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
ms_android_
hack_volume
(
env
);
ms_mutex_unlock
(
&
octx
->
stream_mutex
);
}
...
...
msaaudio_recorder.cpp
View file @
1c4f9008
...
...
@@ -205,7 +205,7 @@ static void android_snd_read_preprocess(MSFilter *obj) {
aaudio_recorder_init
(
ictx
);
JNIEnv
*
env
=
ms_get_jni_env
();
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
ictx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
ms_android_
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
ictx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
}
static
void
android_snd_read_process
(
MSFilter
*
obj
)
{
...
...
@@ -265,7 +265,7 @@ static void android_snd_read_postprocess(MSFilter *obj) {
ms_message
(
"[AAudio] Hardware echo canceller deleted"
);
}
set_bt_enable
(
env
,
FALSE
);
ms_android_
set_bt_enable
(
env
,
FALSE
);
ms_mutex_unlock
(
&
ictx
->
mutex
);
}
...
...
@@ -320,7 +320,7 @@ static int android_snd_read_set_device_id(MSFilter *obj, void *data) {
ictx
->
aaudio_context
->
device_changed
=
true
;
JNIEnv
*
env
=
ms_get_jni_env
();
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
ictx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
ms_android_
set_bt_enable
(
env
,
(
ms_snd_card_get_device_type
(
ictx
->
soundCard
)
==
MSSndCardDeviceType
::
MS_SND_CARD_DEVICE_TYPE_BLUETOOTH
));
ms_mutex_unlock
(
&
ictx
->
stream_mutex
);
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment