OSDN Git Service

MediaPlayer: scanInternalSubtitleTracks in synchronous prepare
authorRobert Shih <robertshih@google.com>
Fri, 25 Jul 2014 18:08:50 +0000 (11:08 -0700)
committerRobert Shih <robertshih@google.com>
Tue, 29 Jul 2014 18:55:46 +0000 (11:55 -0700)
Bug: 16385674
Change-Id: I56d205ad2fe33bd64ea2251440c88fd4ecfa13ad

media/java/android/media/MediaPlayer.java
media/jni/android_media_MediaPlayer.cpp

index d9217a0..907615d 100644 (file)
@@ -1108,7 +1108,12 @@ public class MediaPlayer implements SubtitleController.Listener
      *
      * @throws IllegalStateException if it is called in an invalid state
      */
-    public native void prepare() throws IOException, IllegalStateException;
+    public void prepare() throws IOException, IllegalStateException {
+        _prepare();
+        scanInternalSubtitleTracks();
+    }
+
+    private native void _prepare() throws IOException, IllegalStateException;
 
     /**
      * Prepares the player for playback, asynchronously.
index 4587cf5..73a924d 100644 (file)
@@ -861,7 +861,7 @@ static JNINativeMethod gMethods[] = {
 
     {"_setDataSource",       "(Ljava/io/FileDescriptor;JJ)V",    (void *)android_media_MediaPlayer_setDataSourceFD},
     {"_setVideoSurface",    "(Landroid/view/Surface;)V",        (void *)android_media_MediaPlayer_setVideoSurface},
-    {"prepare",             "()V",                              (void *)android_media_MediaPlayer_prepare},
+    {"_prepare",            "()V",                              (void *)android_media_MediaPlayer_prepare},
     {"prepareAsync",        "()V",                              (void *)android_media_MediaPlayer_prepareAsync},
     {"_start",              "()V",                              (void *)android_media_MediaPlayer_start},
     {"_stop",               "()V",                              (void *)android_media_MediaPlayer_stop},