diff options
Diffstat (limited to 'media/jni')
-rw-r--r-- | media/jni/android_media_MediaSync.cpp | 23 | ||||
-rw-r--r-- | media/jni/android_media_MediaSync.h | 2 |
2 files changed, 25 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 }, diff --git a/media/jni/android_media_MediaSync.h b/media/jni/android_media_MediaSync.h index 9e5de7e..cf81a72 100644 --- a/media/jni/android_media_MediaSync.h +++ b/media/jni/android_media_MediaSync.h @@ -41,6 +41,8 @@ struct JMediaSync : public RefBase { status_t setPlaybackRate(float rate); + status_t getPlayTimeForPendingAudioFrames(int64_t *outTimeUs); + sp<const MediaClock> getMediaClock(); protected: |