Loading media/libaudioclient/AudioTrack.cpp +6 −9 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <math.h> #include <sys/resource.h> #include <audio_utils/clock.h> #include <audio_utils/primitives.h> #include <binder/IPCThreadState.h> #include <media/AudioTrack.h> Loading Loading @@ -62,11 +63,6 @@ static int64_t convertTimespecToUs(const struct timespec &tv) return tv.tv_sec * 1000000ll + tv.tv_nsec / 1000; } static inline nsecs_t convertTimespecToNs(const struct timespec &tv) { return tv.tv_sec * (long long)NANOS_PER_SECOND + tv.tv_nsec; } // current monotonic time in microseconds. static int64_t getNowUs() { Loading Loading @@ -2563,7 +2559,7 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp) // We update the timestamp time even when paused. if (mState == STATE_PAUSED /* not needed: STATE_PAUSED_STOPPING */) { const int64_t now = systemTime(); const int64_t at = convertTimespecToNs(timestamp.mTime); const int64_t at = audio_utils_ns_from_timespec(×tamp.mTime); const int64_t lag = (ets.mTimeNs[ExtendedTimestamp::LOCATION_SERVER_LASTKERNELOK] < 0 || ets.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL_LASTKERNELOK] < 0) Loading Loading @@ -2695,8 +2691,9 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp) // This is sometimes caused by erratic reports of the available space in the ALSA drivers. if (status == NO_ERROR) { if (previousTimestampValid) { const int64_t previousTimeNanos = convertTimespecToNs(mPreviousTimestamp.mTime); const int64_t currentTimeNanos = convertTimespecToNs(timestamp.mTime); const int64_t previousTimeNanos = audio_utils_ns_from_timespec(&mPreviousTimestamp.mTime); const int64_t currentTimeNanos = audio_utils_ns_from_timespec(×tamp.mTime); if (currentTimeNanos < previousTimeNanos) { ALOGW("retrograde timestamp time corrected, %lld < %lld", (long long)currentTimeNanos, (long long)previousTimeNanos); Loading Loading @@ -2726,7 +2723,7 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp) #if 0 // Uncomment this to verify audio timestamp rate. const int64_t deltaTime = convertTimespecToNs(timestamp.mTime) - previousTimeNanos; audio_utils_ns_from_timespec(×tamp.mTime) - previousTimeNanos; if (deltaTime != 0) { const int64_t computedSampleRate = deltaPosition * (long long)NANOS_PER_SECOND / deltaTime; Loading media/libnbaio/AudioStreamOutSink.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ //#define LOG_NDEBUG 0 #include <utils/Log.h> #include <audio_utils/clock.h> #include <media/audiohal/StreamHalInterface.h> #include <media/nbaio/AudioStreamOutSink.h> Loading Loading @@ -82,8 +83,7 @@ status_t AudioStreamOutSink::getTimestamp(ExtendedTimestamp ×tamp) return INVALID_OPERATION; } timestamp.mPosition[ExtendedTimestamp::LOCATION_KERNEL] = position64; timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] = time.tv_sec * 1000000000LL + time.tv_nsec; timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] = audio_utils_ns_from_timespec(&time); return OK; } Loading services/audioflinger/Tracks.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -50,10 +50,6 @@ #define ALOGVV(a...) do { } while(0) #endif // TODO move to a common header (Also shared with AudioTrack.cpp) #define NANOS_PER_SECOND 1000000000 #define TIME_TO_NANOS(time) ((uint64_t)(time).tv_sec * NANOS_PER_SECOND + (time).tv_nsec) namespace android { // ---------------------------------------------------------------------------- Loading Loading
media/libaudioclient/AudioTrack.cpp +6 −9 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <math.h> #include <sys/resource.h> #include <audio_utils/clock.h> #include <audio_utils/primitives.h> #include <binder/IPCThreadState.h> #include <media/AudioTrack.h> Loading Loading @@ -62,11 +63,6 @@ static int64_t convertTimespecToUs(const struct timespec &tv) return tv.tv_sec * 1000000ll + tv.tv_nsec / 1000; } static inline nsecs_t convertTimespecToNs(const struct timespec &tv) { return tv.tv_sec * (long long)NANOS_PER_SECOND + tv.tv_nsec; } // current monotonic time in microseconds. static int64_t getNowUs() { Loading Loading @@ -2563,7 +2559,7 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp) // We update the timestamp time even when paused. if (mState == STATE_PAUSED /* not needed: STATE_PAUSED_STOPPING */) { const int64_t now = systemTime(); const int64_t at = convertTimespecToNs(timestamp.mTime); const int64_t at = audio_utils_ns_from_timespec(×tamp.mTime); const int64_t lag = (ets.mTimeNs[ExtendedTimestamp::LOCATION_SERVER_LASTKERNELOK] < 0 || ets.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL_LASTKERNELOK] < 0) Loading Loading @@ -2695,8 +2691,9 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp) // This is sometimes caused by erratic reports of the available space in the ALSA drivers. if (status == NO_ERROR) { if (previousTimestampValid) { const int64_t previousTimeNanos = convertTimespecToNs(mPreviousTimestamp.mTime); const int64_t currentTimeNanos = convertTimespecToNs(timestamp.mTime); const int64_t previousTimeNanos = audio_utils_ns_from_timespec(&mPreviousTimestamp.mTime); const int64_t currentTimeNanos = audio_utils_ns_from_timespec(×tamp.mTime); if (currentTimeNanos < previousTimeNanos) { ALOGW("retrograde timestamp time corrected, %lld < %lld", (long long)currentTimeNanos, (long long)previousTimeNanos); Loading Loading @@ -2726,7 +2723,7 @@ status_t AudioTrack::getTimestamp_l(AudioTimestamp& timestamp) #if 0 // Uncomment this to verify audio timestamp rate. const int64_t deltaTime = convertTimespecToNs(timestamp.mTime) - previousTimeNanos; audio_utils_ns_from_timespec(×tamp.mTime) - previousTimeNanos; if (deltaTime != 0) { const int64_t computedSampleRate = deltaPosition * (long long)NANOS_PER_SECOND / deltaTime; Loading
media/libnbaio/AudioStreamOutSink.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ //#define LOG_NDEBUG 0 #include <utils/Log.h> #include <audio_utils/clock.h> #include <media/audiohal/StreamHalInterface.h> #include <media/nbaio/AudioStreamOutSink.h> Loading Loading @@ -82,8 +83,7 @@ status_t AudioStreamOutSink::getTimestamp(ExtendedTimestamp ×tamp) return INVALID_OPERATION; } timestamp.mPosition[ExtendedTimestamp::LOCATION_KERNEL] = position64; timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] = time.tv_sec * 1000000000LL + time.tv_nsec; timestamp.mTimeNs[ExtendedTimestamp::LOCATION_KERNEL] = audio_utils_ns_from_timespec(&time); return OK; } Loading
services/audioflinger/Tracks.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -50,10 +50,6 @@ #define ALOGVV(a...) do { } while(0) #endif // TODO move to a common header (Also shared with AudioTrack.cpp) #define NANOS_PER_SECOND 1000000000 #define TIME_TO_NANOS(time) ((uint64_t)(time).tv_sec * NANOS_PER_SECOND + (time).tv_nsec) namespace android { // ---------------------------------------------------------------------------- Loading