summaryrefslogtreecommitdiffstats
path: root/media/jni/android_media_MediaSync.cpp
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-04-23 14:10:30 -0700
committerWei Jia <wjia@google.com>2015-04-23 15:47:50 -0700
commit25b802d47249702b9e5d175b3e7144934b67553d (patch)
treee153234b653bafca019bf5c2f5e7073310ef839b /media/jni/android_media_MediaSync.cpp
parent7fadb2f5428e0b8a1a327cd300c0ade8a6fdc348 (diff)
downloadframeworks_base-25b802d47249702b9e5d175b3e7144934b67553d.zip
frameworks_base-25b802d47249702b9e5d175b3e7144934b67553d.tar.gz
frameworks_base-25b802d47249702b9e5d175b3e7144934b67553d.tar.bz2
MediaSync: fix message delay based on play time for pending audio frames.
Bug: 19666434 Change-Id: Ia9ad3858d4ddccf8aa476f2506785f1d76f90b32
Diffstat (limited to 'media/jni/android_media_MediaSync.cpp')
-rw-r--r--media/jni/android_media_MediaSync.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
index 72dacdf..f192262 100644
--- a/media/jni/android_media_MediaSync.cpp
+++ b/media/jni/android_media_MediaSync.cpp
@@ -86,6 +86,10 @@ status_t JMediaSync::updateQueuedAudioData(
return mSync->updateQueuedAudioData(sizeInBytes, presentationTimeUs);
}
+status_t JMediaSync::getPlayTimeForPendingAudioFrames(int64_t *outTimeUs) {
+ return mSync->getPlayTimeForPendingAudioFrames(outTimeUs);
+}
+
} // namespace android
////////////////////////////////////////////////////////////////////////////////
@@ -268,6 +272,21 @@ static jboolean android_media_MediaSync_native_getTimestamp(
return JNI_TRUE;
}
+static jlong android_media_MediaSync_native_getPlayTimeForPendingAudioFrames(
+ JNIEnv *env, jobject thiz) {
+ sp<JMediaSync> sync = getMediaSync(env, thiz);
+ if (sync == NULL) {
+ throwExceptionAsNecessary(env, INVALID_OPERATION);
+ }
+
+ int64_t playTimeUs = 0;
+ status_t err = sync->getPlayTimeForPendingAudioFrames(&playTimeUs);
+ if (err != NO_ERROR) {
+ throwExceptionAsNecessary(env, err);
+ }
+ return (jlong)playTimeUs;
+}
+
static void
android_media_MediaSync_setSyncSettings(JNIEnv *env, jobject thiz, jobject settings)
{
@@ -387,6 +406,10 @@ static JNINativeMethod gMethods[] = {
"(Landroid/media/MediaTimestamp;)Z",
(void *)android_media_MediaSync_native_getTimestamp },
+ { "native_getPlayTimeForPendingAudioFrames",
+ "()J",
+ (void *)android_media_MediaSync_native_getPlayTimeForPendingAudioFrames },
+
{ "native_init", "()V", (void *)android_media_MediaSync_native_init },
{ "native_setup", "()V", (void *)android_media_MediaSync_native_setup },