summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher N. Hesse <raymanfx@gmail.com>2017-02-15 09:47:20 +0100
committerChristopher N. Hesse <raymanfx@gmail.com>2017-02-15 11:25:45 +0100
commit74c317d1bd36e3cfdcbf28594c1af6446069dcdc (patch)
tree4e2058d184d11773930c155aa2f4b48b1a48817c
parente0058816e9a0d31827813ce6cd97101d471b6d71 (diff)
downloadandroid_hardware_samsung-74c317d1bd36e3cfdcbf28594c1af6446069dcdc.tar.gz
android_hardware_samsung-74c317d1bd36e3cfdcbf28594c1af6446069dcdc.tar.bz2
android_hardware_samsung-74c317d1bd36e3cfdcbf28594c1af6446069dcdc.zip
audio: Guard WB_AMR callback
Some devices do not support this; some devices are WiFi only and obviously do not have it. Change-Id: I6d245eee447bd87849cbdfd41c0cf73c6af714e6
-rw-r--r--audio/include/samsung_audio.h11
-rw-r--r--audio/ril_interface.h2
-rw-r--r--audio/voice.c24
3 files changed, 26 insertions, 11 deletions
diff --git a/audio/include/samsung_audio.h b/audio/include/samsung_audio.h
index 1e84c05..c1504f7 100644
--- a/audio/include/samsung_audio.h
+++ b/audio/include/samsung_audio.h
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <telephony/ril.h>
+
#ifndef SAMSUNG_AUDIO_H
#define SAMSUNG_AUDIO_H
@@ -43,6 +45,15 @@
#define SOUND_PLAYBACK_VOICE_DEVICE 1
#define SOUND_CAPTURE_VOICE_DEVICE 1
+/* Wideband AMR callback */
+#ifndef RIL_UNSOL_SNDMGR_WB_AMR_REPORT
+#ifdef RIL_UNSOL_WB_AMR_STATE
+#define RIL_UNSOL_SNDMGR_WB_AMR_REPORT RIL_UNSOL_WB_AMR_STATE
+#else
+#define RIL_UNSOL_SNDMGR_WB_AMR_REPORT 0
+#endif
+#endif
+
/* Unusupported
#define SOUND_CAPTURE_LOOPBACK_AEC_DEVICE 1
#define SOUND_CAPTURE_HOTWORD_DEVICE 0
diff --git a/audio/ril_interface.h b/audio/ril_interface.h
index d68c6b4..792b15b 100644
--- a/audio/ril_interface.h
+++ b/audio/ril_interface.h
@@ -17,7 +17,7 @@
#ifndef RIL_INTERFACE_H
#define RIL_INTERFACE_H
-#include <telephony/ril.h>
+#include <samsung_audio.h>
#include <secril-client.h>
typedef void (*ril_wb_amr_callback)(void *data, int enable);
diff --git a/audio/voice.c b/audio/voice.c
index 8d73fd1..3ac1e01 100644
--- a/audio/voice.c
+++ b/audio/voice.c
@@ -401,17 +401,21 @@ struct voice_session *voice_session_init(struct audio_device *adev)
session->wb_amr = true;
ALOGV("%s: Forcing voice config: %s", __func__, voice_config);
} else {
- /* register callback for wideband AMR setting */
- ret = ril_set_wb_amr_callback(&session->ril,
- voice_session_wb_amr_callback,
- (void *)adev);
- if (ret != 0) {
- ALOGE("%s: Failed to register WB_AMR callback", __func__);
- free(session);
- return NULL;
+ if (RIL_UNSOL_SNDMGR_WB_AMR_REPORT > 0) {
+ /* register callback for wideband AMR setting */
+ ret = ril_set_wb_amr_callback(&session->ril,
+ voice_session_wb_amr_callback,
+ (void *)adev);
+ if (ret != 0) {
+ ALOGE("%s: Failed to register WB_AMR callback", __func__);
+ free(session);
+ return NULL;
+ }
+
+ ALOGV("%s: Registered WB_AMR callback", __func__);
+ } else {
+ ALOGV("%s: WB_AMR callback not supported", __func__);
}
-
- ALOGV("%s: Registered WB_AMR callback", __func__);
}
return session;