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

Commit bf750dce authored by Andy Hung's avatar Andy Hung Committed by android-build-merger
Browse files

Merge "AudioTimestamp: Use current time when data pipeline is empty" into qt-dev am: d9626301

am: b99be946

Change-Id: I3ce3976138eb40dd6b567e91ad6c98b387768f9d
parents 256289d2 b99be946
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2603,6 +2603,20 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp)
                    ALOGV_IF(mPreviousLocation == ExtendedTimestamp::LOCATION_SERVER,
                            "%s(%d): location moved from server to kernel",
                            __func__, mPortId);

                    if (ets.mPosition[ExtendedTimestamp::LOCATION_SERVER] ==
                            ets.mPosition[ExtendedTimestamp::LOCATION_KERNEL]) {
                        // In Q, we don't return errors as an invalid time
                        // but instead we leave the last kernel good timestamp alone.
                        //
                        // If server is identical to kernel, the device data pipeline is idle.
                        // A better start time is now.  The retrograde check ensures
                        // timestamp monotonicity.
                        const int64_t nowNs = systemTime();
                        ALOGD("%s(%d) device stall, using current time %lld",
                                __func__, mPortId, (long long)nowNs);
                        timestamp.mTime = convertNsToTimespec(nowNs);
                    }
                }

                // We update the timestamp time even when paused.