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

Commit 24b51660 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5422062 from 6ac6f948 to qt-release

Change-Id: I1b97a2b9ed981229b9fe118e5f056700e3e55240
parents 2a9dc0a8 6ac6f948
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -4441,15 +4441,11 @@ 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.
// Read offset for the positional timestamp from a persistent vendor property.
// This is to workaround apparent inaccuracies in the timing information that
// is used by the AAudio timing model. The inaccuracies can cause 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.
    const int32_t kDefaultOffsetMicros = 0;
    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);
@@ -4580,8 +4576,8 @@ static int in_get_mmap_position(const struct audio_stream_in *stream,
        ALOGE("%s: %s", __func__, pcm_get_error(in->pcm));
        goto exit;
    }
    position->time_nanoseconds = audio_utils_ns_from_timespec(&ts);
    position->time_nanoseconds += in->mmap_time_offset_nanos;
    position->time_nanoseconds = audio_utils_ns_from_timespec(&ts)
            + in->mmap_time_offset_nanos;

exit:
    pthread_mutex_unlock(&in->lock);