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

Commit 2073167c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5342135 from fd8cb83b to qt-release

Change-Id: Ida21bb133f847dee7106cfe4b638285c88bacb78
parents 11f1cd01 fd8cb83b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@
// System properties used for A2DP Offload
#define SYSPROP_A2DP_OFFLOAD_SUPPORTED "ro.bluetooth.a2dp_offload.supported"
#define SYSPROP_A2DP_OFFLOAD_DISABLED  "persist.bluetooth.a2dp_offload.disabled"
#define SYSPROP_BLUETOOTH_AUDIO_HAL_DISABLED  "persist.vendor.bluetooth.bluetooth_audio_hal.disabled"
#define SYSPROP_BLUETOOTH_AUDIO_HAL_ENABLED  "persist.vendor.bluetooth.bluetooth_audio_hal.enabled"
#define SYSPROP_A2DP_CODEC_LATENCIES   "vendor.audio.a2dp.codec.latency"

// Default encoder bit width
@@ -680,7 +680,7 @@ static int open_a2dp_output()
    int ret = 0;
    ALOGD("%s: Open A2DP output start", __func__);
    bool hal_v2_enabled =
              !property_get_bool(SYSPROP_BLUETOOTH_AUDIO_HAL_DISABLED, false);
              property_get_bool(SYSPROP_BLUETOOTH_AUDIO_HAL_ENABLED, false);

    if (a2dp.bt_state != A2DP_STATE_DISCONNECTED) {
        ALOGD("%s: Called A2DP open with improper state, Ignoring request state %d",
+19 −0
Original line number Diff line number Diff line
@@ -4427,6 +4427,21 @@ static int in_start(const struct audio_stream_in* stream)
    return ret;
}

// Read offset for the input positional timestamp from a property.
// This is to workaround apparent inaccuracies in the timing info that
// are causing glitches.
static int64_t in_get_mmap_time_offset() {
    // Roughly 100 usec is needed on some devices to cover inaccuracy in DSP.
    // This should be set in a property. But I cannot read the property!
    // So I am setting the offset here to 101 as a test.
    const int32_t kDefaultOffsetMicros = 101; // should be zero if no bug
    // FIXME - why is the property not being read?! The default is used.
    int32_t mmap_time_offset_micros = property_get_int32(
        "persist.audio.in_mmap_delay_micros", kDefaultOffsetMicros);
    ALOGI("in_get_mmap_time_offset set to %d micros", mmap_time_offset_micros);
    return mmap_time_offset_micros * (int64_t)1000;
}

static int in_create_mmap_buffer(const struct audio_stream_in *stream,
                                  int32_t min_size_frames,
                                  struct audio_mmap_buffer_info *info)
@@ -4507,6 +4522,8 @@ static int in_create_mmap_buffer(const struct audio_stream_in *stream,
        goto exit;
    }

    in->mmap_time_offset_nanos = in_get_mmap_time_offset();

    in->standby = false;
    ret = 0;

@@ -4550,6 +4567,8 @@ static int in_get_mmap_position(const struct audio_stream_in *stream,
        goto exit;
    }
    position->time_nanoseconds = audio_utils_ns_from_timespec(&ts);
    position->time_nanoseconds += in->mmap_time_offset_nanos;

exit:
    pthread_mutex_unlock(&in->lock);
    return ret;
+1 −0
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ struct stream_in {
    bool enable_ns;
    int64_t frames_read; /* total frames read, not cleared when entering standby */
    int64_t frames_muted; /* total frames muted, not cleared when entering standby */
    int64_t mmap_time_offset_nanos; /* fudge factor to correct inaccuracies in DSP */

    audio_io_handle_t capture_handle;
    audio_input_flags_t flags;