summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioPlayer.cpp
diff options
context:
space:
mode:
authorBertil Akesson <bertil.akesson@sonymobile.com>2013-11-22 12:32:58 +0100
committerSteve Kondik <steve@cyngn.com>2015-11-30 20:27:52 -0800
commit8a55244e9847fba8252933ced56b56ecc77204eb (patch)
tree1d40745122ae594959f8a1296df1e698cf3c19cf /media/libstagefright/AudioPlayer.cpp
parent118bc1d9282358cb203ad1520ab84054a818cde4 (diff)
downloadframeworks_av-8a55244e9847fba8252933ced56b56ecc77204eb.zip
frameworks_av-8a55244e9847fba8252933ced56b56ecc77204eb.tar.gz
frameworks_av-8a55244e9847fba8252933ced56b56ecc77204eb.tar.bz2
Correct the time returned by AudioPlayer::getMediaTime
The change 80a68deec52c9a1b47215ed68526206ec88197f8 was added to eliminate returning negative media positions. In the change all negative values of realTimeOffset were discarded. The value realTimeOffset accounts for the latency and the number of samples played since last feeding the AudioTrack and is generally negative. By discarding this value for negative values the time returned does not account for latency or the number of samples played. Change-Id: I470450934228732e34539c227365a225be74ccc8
Diffstat (limited to 'media/libstagefright/AudioPlayer.cpp')
-rw-r--r--media/libstagefright/AudioPlayer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 1ff5d4f..95441bc 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -817,8 +817,8 @@ int64_t AudioPlayer::getMediaTimeUs() {
}
int64_t realTimeOffset = getRealTimeUsLocked() - mPositionTimeRealUs;
- if (realTimeOffset < 0) {
- realTimeOffset = 0;
+ if (mPositionTimeMediaUs + realTimeOffset < 0) {
+ return 0;
}
return mPositionTimeMediaUs + realTimeOffset;