Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cec8ad8b authored by Uday Kishore Pasupuleti's avatar Uday Kishore Pasupuleti Committed by Prashant Malani
Browse files

Remove playback support on speaker

Only A2DP playback is supported on wearables so remove
audio playback support on speaker if NO_AUDIO_OUT is defined.

Bug: 20134606, 20081871, 20068070
Change-Id: I300bec8e0b645b431c437e57077eaa35d6ad6093
parent e406d08e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HFP)),true)
    LOCAL_SRC_FILES += audio_extn/hfp.c
endif

ifeq ($(strip $(AUDIO_FEATURE_NO_AUDIO_OUT)),true)
    LOCAL_CFLAGS += -DNO_AUDIO_OUT
endif

LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)

LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+21 −0
Original line number Diff line number Diff line
@@ -1446,6 +1446,23 @@ static int out_set_volume(struct audio_stream_out *stream, float left,
    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,
                         size_t bytes)
{
@@ -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.get_latency = out_get_latency;
    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;
#endif
    out->stream.get_render_position = out_get_render_position;
    out->stream.get_next_write_timestamp = out_get_next_write_timestamp;
    out->stream.get_presentation_position = out_get_presentation_position;