Merge "Move vintf_fragments for sw C2 to mediaserver" into qt-dev
diff --git a/apex/manifest.json b/apex/manifest.json
index c6c63f6..cee94e2 100644
--- a/apex/manifest.json
+++ b/apex/manifest.json
@@ -1,4 +1,4 @@
 {
   "name": "com.android.media",
-  "version": 200000000
+  "version": 210000000
 }
diff --git a/apex/manifest_codec.json b/apex/manifest_codec.json
index 4f31b15..b83e65a 100644
--- a/apex/manifest_codec.json
+++ b/apex/manifest_codec.json
@@ -1,4 +1,4 @@
 {
   "name": "com.android.media.swcodec",
-  "version": 200000000
+  "version": 210000000
 }
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index e59f7e0..ded9cb7 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -2603,6 +2603,20 @@
                     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.