Loading system/audio_a2dp_hw/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ LOCAL_CFLAGS += -std=c99 $(bdroid_CFLAGS) LOCAL_MODULE := audio.a2dp.default LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SHARED_LIBRARIES := libcutils liblog LOCAL_SHARED_LIBRARIES := liblog LOCAL_STATIC_LIBRARIES := libosi LOCAL_MODULE_TAGS := optional Loading system/audio_a2dp_hw/audio_a2dp_hw.c +29 −37 Original line number Diff line number Diff line Loading @@ -39,13 +39,14 @@ #include <sys/un.h> #include <unistd.h> #include <cutils/str_parms.h> #include <hardware/audio.h> #include <hardware/hardware.h> #include <system/audio.h> #include "audio_a2dp_hw.h" #include "bt_utils.h" #include "osi/include/hash_map.h" #include "osi/include/hash_map_utils.h" #include "osi/include/log.h" #include "osi/include/socket_utils/sockets.h" Loading Loading @@ -679,36 +680,31 @@ static int out_dump(const struct audio_stream *stream, int fd) static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) { struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream; struct str_parms *parms; char keyval[16]; int retval; int status = 0; INFO("state %d", out->common.state); pthread_mutex_lock(&out->common.lock); parms = str_parms_create_str(kvpairs); hash_map_t *params = hash_map_utils_new_from_string_params(kvpairs); int status = 0; if (!params) return status; /* dump params */ str_parms_dump(parms); hash_map_utils_dump_string_keys_string_values(params); retval = str_parms_get_str(parms, "closing", keyval, sizeof(keyval)); char *keyval = (char *)hash_map_get(params, "closing"); if (retval >= 0) { if (strcmp(keyval, "true") == 0) if (keyval && strcmp(keyval, "true") == 0) { DEBUG("stream closing, disallow any writes"); out->common.state = AUDIO_A2DP_STATE_STOPPING; } } retval = str_parms_get_str(parms, "A2dpSuspended", keyval, sizeof(keyval)); keyval = (char *)hash_map_get(params, "A2dpSuspended"); if (retval >= 0) { if (strcmp(keyval, "true") == 0) if (keyval && strcmp(keyval, "true") == 0) { if (out->common.state == AUDIO_A2DP_STATE_STARTED) status = suspend_audio_datapath(&out->common, false); Loading @@ -722,10 +718,9 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) out->common.state = AUDIO_A2DP_STATE_STANDBY; /* Irrespective of the state, return 0 */ } } pthread_mutex_unlock(&out->common.lock); str_parms_destroy(parms); hash_map_free(params); return status; } Loading Loading @@ -1108,16 +1103,13 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) static char * adev_get_parameters(const struct audio_hw_device *dev, const char *keys) { struct str_parms *parms; UNUSED(dev); FNLOG(); parms = str_parms_create_str(keys); str_parms_dump(parms); str_parms_destroy(parms); hash_map_t *params = hash_map_utils_new_from_string_params(keys); hash_map_utils_dump_string_keys_string_values(params); hash_map_free(params); return strdup(""); } Loading system/osi/Android.mk +5 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,8 @@ LOCAL_CLANG := false LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/include \ $(LOCAL_PATH)/.. $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/../utils/include # TODO(mcchou): Remove socket_utils sources after platform specific # dependencies are abstracted. Loading @@ -42,6 +43,7 @@ LOCAL_SRC_FILES := \ ./src/future.c \ ./src/hash_functions.c \ ./src/hash_map.c \ ./src/hash_map_utils.c \ ./src/list.c \ ./src/non_repeating_timer.c \ ./src/reactor.c \ Loading Loading @@ -78,6 +80,7 @@ LOCAL_SRC_FILES := \ ./test/AllocationTestHarness.cpp \ ./test/alarm_test.cpp \ ./test/allocation_tracker_test.cpp \ ./test/allocator_test.cpp \ ./test/array_test.cpp \ ./test/atomic_test.cpp \ ./test/config_test.cpp \ Loading @@ -85,6 +88,7 @@ LOCAL_SRC_FILES := \ ./test/eager_reader_test.cpp \ ./test/future_test.cpp \ ./test/hash_map_test.cpp \ ./test/hash_map_utils_test.cpp \ ./test/list_test.cpp \ ./test/reactor_test.cpp \ ./test/ringbuffer_test.cpp \ Loading system/osi/BUILD.gn +5 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ static_library("osi") { "src/future.c", "src/hash_functions.c", "src/hash_map.c", "src/hash_map_utils.c", "src/list.c", "src/non_repeating_timer.c", "src/reactor.c", Loading @@ -46,7 +47,8 @@ static_library("osi") { include_dirs = [ "include", "//" "//", "//utils/include", ] } Loading @@ -57,6 +59,7 @@ executable("net_test_osi") { "test/AllocationTestHarness.cpp", "test/alarm_test.cpp", "test/allocation_tracker_test.cpp", "test/allocator_test.cpp", "test/array_test.cpp", "test/atomic_test.cpp", "test/config_test.cpp", Loading @@ -64,6 +67,7 @@ executable("net_test_osi") { "test/eager_reader_test.cpp", "test/future_test.cpp", "test/hash_map_test.cpp", "test/hash_map_utils_test.cpp", "test/list_test.cpp", "test/reactor_test.cpp", "test/ringbuffer_test.cpp", Loading system/osi/include/allocator.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ extern const allocator_t allocator_malloc; extern const allocator_t allocator_calloc; char *osi_strdup(const char *str); char *osi_strndup(const char *str, size_t len); void *osi_malloc(size_t size); void *osi_calloc(size_t size); Loading Loading
system/audio_a2dp_hw/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ LOCAL_CFLAGS += -std=c99 $(bdroid_CFLAGS) LOCAL_MODULE := audio.a2dp.default LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SHARED_LIBRARIES := libcutils liblog LOCAL_SHARED_LIBRARIES := liblog LOCAL_STATIC_LIBRARIES := libosi LOCAL_MODULE_TAGS := optional Loading
system/audio_a2dp_hw/audio_a2dp_hw.c +29 −37 Original line number Diff line number Diff line Loading @@ -39,13 +39,14 @@ #include <sys/un.h> #include <unistd.h> #include <cutils/str_parms.h> #include <hardware/audio.h> #include <hardware/hardware.h> #include <system/audio.h> #include "audio_a2dp_hw.h" #include "bt_utils.h" #include "osi/include/hash_map.h" #include "osi/include/hash_map_utils.h" #include "osi/include/log.h" #include "osi/include/socket_utils/sockets.h" Loading Loading @@ -679,36 +680,31 @@ static int out_dump(const struct audio_stream *stream, int fd) static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) { struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream; struct str_parms *parms; char keyval[16]; int retval; int status = 0; INFO("state %d", out->common.state); pthread_mutex_lock(&out->common.lock); parms = str_parms_create_str(kvpairs); hash_map_t *params = hash_map_utils_new_from_string_params(kvpairs); int status = 0; if (!params) return status; /* dump params */ str_parms_dump(parms); hash_map_utils_dump_string_keys_string_values(params); retval = str_parms_get_str(parms, "closing", keyval, sizeof(keyval)); char *keyval = (char *)hash_map_get(params, "closing"); if (retval >= 0) { if (strcmp(keyval, "true") == 0) if (keyval && strcmp(keyval, "true") == 0) { DEBUG("stream closing, disallow any writes"); out->common.state = AUDIO_A2DP_STATE_STOPPING; } } retval = str_parms_get_str(parms, "A2dpSuspended", keyval, sizeof(keyval)); keyval = (char *)hash_map_get(params, "A2dpSuspended"); if (retval >= 0) { if (strcmp(keyval, "true") == 0) if (keyval && strcmp(keyval, "true") == 0) { if (out->common.state == AUDIO_A2DP_STATE_STARTED) status = suspend_audio_datapath(&out->common, false); Loading @@ -722,10 +718,9 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) out->common.state = AUDIO_A2DP_STATE_STANDBY; /* Irrespective of the state, return 0 */ } } pthread_mutex_unlock(&out->common.lock); str_parms_destroy(parms); hash_map_free(params); return status; } Loading Loading @@ -1108,16 +1103,13 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) static char * adev_get_parameters(const struct audio_hw_device *dev, const char *keys) { struct str_parms *parms; UNUSED(dev); FNLOG(); parms = str_parms_create_str(keys); str_parms_dump(parms); str_parms_destroy(parms); hash_map_t *params = hash_map_utils_new_from_string_params(keys); hash_map_utils_dump_string_keys_string_values(params); hash_map_free(params); return strdup(""); } Loading
system/osi/Android.mk +5 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,8 @@ LOCAL_CLANG := false LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/include \ $(LOCAL_PATH)/.. $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/../utils/include # TODO(mcchou): Remove socket_utils sources after platform specific # dependencies are abstracted. Loading @@ -42,6 +43,7 @@ LOCAL_SRC_FILES := \ ./src/future.c \ ./src/hash_functions.c \ ./src/hash_map.c \ ./src/hash_map_utils.c \ ./src/list.c \ ./src/non_repeating_timer.c \ ./src/reactor.c \ Loading Loading @@ -78,6 +80,7 @@ LOCAL_SRC_FILES := \ ./test/AllocationTestHarness.cpp \ ./test/alarm_test.cpp \ ./test/allocation_tracker_test.cpp \ ./test/allocator_test.cpp \ ./test/array_test.cpp \ ./test/atomic_test.cpp \ ./test/config_test.cpp \ Loading @@ -85,6 +88,7 @@ LOCAL_SRC_FILES := \ ./test/eager_reader_test.cpp \ ./test/future_test.cpp \ ./test/hash_map_test.cpp \ ./test/hash_map_utils_test.cpp \ ./test/list_test.cpp \ ./test/reactor_test.cpp \ ./test/ringbuffer_test.cpp \ Loading
system/osi/BUILD.gn +5 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ static_library("osi") { "src/future.c", "src/hash_functions.c", "src/hash_map.c", "src/hash_map_utils.c", "src/list.c", "src/non_repeating_timer.c", "src/reactor.c", Loading @@ -46,7 +47,8 @@ static_library("osi") { include_dirs = [ "include", "//" "//", "//utils/include", ] } Loading @@ -57,6 +59,7 @@ executable("net_test_osi") { "test/AllocationTestHarness.cpp", "test/alarm_test.cpp", "test/allocation_tracker_test.cpp", "test/allocator_test.cpp", "test/array_test.cpp", "test/atomic_test.cpp", "test/config_test.cpp", Loading @@ -64,6 +67,7 @@ executable("net_test_osi") { "test/eager_reader_test.cpp", "test/future_test.cpp", "test/hash_map_test.cpp", "test/hash_map_utils_test.cpp", "test/list_test.cpp", "test/reactor_test.cpp", "test/ringbuffer_test.cpp", Loading
system/osi/include/allocator.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ extern const allocator_t allocator_malloc; extern const allocator_t allocator_calloc; char *osi_strdup(const char *str); char *osi_strndup(const char *str, size_t len); void *osi_malloc(size_t size); void *osi_calloc(size_t size); Loading