Loading hal/Android.mk +4 −0 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HFP)),true) LOCAL_SRC_FILES += audio_extn/hfp.c LOCAL_SRC_FILES += audio_extn/hfp.c endif endif ifeq ($(strip $(AUDIO_FEATURE_NO_AUDIO_OUT)),true) LOCAL_CFLAGS += -DNO_AUDIO_OUT endif LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw Loading hal/audio_hw.c +21 −0 Original line number Original line Diff line number Diff line Loading @@ -1446,6 +1446,23 @@ static int out_set_volume(struct audio_stream_out *stream, float left, return -ENOSYS; return -ENOSYS; } } #ifdef NO_AUDIO_OUT static ssize_t out_write_for_no_output(struct audio_stream_out *stream, const void *buffer, size_t bytes) { struct stream_out *out = (struct stream_out *)stream; /* No Output device supported other than BT for playback. * Sleep for the amount of buffer duration */ pthread_mutex_lock(&out->lock); usleep(bytes * 1000000 / audio_stream_frame_size(&out->stream.common) / out_get_sample_rate(&out->stream.common)); pthread_mutex_unlock(&out->lock); return bytes; } #endif static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, size_t bytes) size_t bytes) { { Loading Loading @@ -2088,7 +2105,11 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->stream.common.remove_audio_effect = out_remove_audio_effect; out->stream.common.remove_audio_effect = out_remove_audio_effect; out->stream.get_latency = out_get_latency; out->stream.get_latency = out_get_latency; out->stream.set_volume = out_set_volume; out->stream.set_volume = out_set_volume; #ifdef NO_AUDIO_OUT out->stream.write = out_write_for_no_output; #else out->stream.write = out_write; out->stream.write = out_write; #endif out->stream.get_render_position = out_get_render_position; out->stream.get_render_position = out_get_render_position; out->stream.get_next_write_timestamp = out_get_next_write_timestamp; out->stream.get_next_write_timestamp = out_get_next_write_timestamp; out->stream.get_presentation_position = out_get_presentation_position; out->stream.get_presentation_position = out_get_presentation_position; Loading Loading
hal/Android.mk +4 −0 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HFP)),true) LOCAL_SRC_FILES += audio_extn/hfp.c LOCAL_SRC_FILES += audio_extn/hfp.c endif endif ifeq ($(strip $(AUDIO_FEATURE_NO_AUDIO_OUT)),true) LOCAL_CFLAGS += -DNO_AUDIO_OUT endif LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw Loading
hal/audio_hw.c +21 −0 Original line number Original line Diff line number Diff line Loading @@ -1446,6 +1446,23 @@ static int out_set_volume(struct audio_stream_out *stream, float left, return -ENOSYS; return -ENOSYS; } } #ifdef NO_AUDIO_OUT static ssize_t out_write_for_no_output(struct audio_stream_out *stream, const void *buffer, size_t bytes) { struct stream_out *out = (struct stream_out *)stream; /* No Output device supported other than BT for playback. * Sleep for the amount of buffer duration */ pthread_mutex_lock(&out->lock); usleep(bytes * 1000000 / audio_stream_frame_size(&out->stream.common) / out_get_sample_rate(&out->stream.common)); pthread_mutex_unlock(&out->lock); return bytes; } #endif static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, size_t bytes) size_t bytes) { { Loading Loading @@ -2088,7 +2105,11 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->stream.common.remove_audio_effect = out_remove_audio_effect; out->stream.common.remove_audio_effect = out_remove_audio_effect; out->stream.get_latency = out_get_latency; out->stream.get_latency = out_get_latency; out->stream.set_volume = out_set_volume; out->stream.set_volume = out_set_volume; #ifdef NO_AUDIO_OUT out->stream.write = out_write_for_no_output; #else out->stream.write = out_write; out->stream.write = out_write; #endif out->stream.get_render_position = out_get_render_position; out->stream.get_render_position = out_get_render_position; out->stream.get_next_write_timestamp = out_get_next_write_timestamp; out->stream.get_next_write_timestamp = out_get_next_write_timestamp; out->stream.get_presentation_position = out_get_presentation_position; out->stream.get_presentation_position = out_get_presentation_position; Loading