Loading media/java/android/media/MediaPlayer.java +8 −12 Original line number Diff line number Diff line Loading @@ -2446,9 +2446,9 @@ public class MediaPlayer implements SubtitleController.Listener throw new IllegalArgumentException("Illegal mimeType for timed text source: " + mime); } FileDescriptor fd2; final FileDescriptor dupedFd; try { fd2 = Libcore.os.dup(fd); dupedFd = Libcore.os.dup(fd); } catch (ErrnoException ex) { Log.e(TAG, ex.getMessage(), ex); throw new RuntimeException(ex); Loading @@ -2473,7 +2473,6 @@ public class MediaPlayer implements SubtitleController.Listener mIndexTrackPairs.add(Pair.<Integer, SubtitleTrack>create(null, track)); } final FileDescriptor fd3 = fd2; final long offset2 = offset; final long length2 = length; final HandlerThread thread = new HandlerThread( Loading @@ -2483,14 +2482,13 @@ public class MediaPlayer implements SubtitleController.Listener Handler handler = new Handler(thread.getLooper()); handler.post(new Runnable() { private int addTrack() { InputStream is = null; final ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { Libcore.os.lseek(fd3, offset2, OsConstants.SEEK_SET); Libcore.os.lseek(dupedFd, offset2, OsConstants.SEEK_SET); byte[] buffer = new byte[4096]; for (long total = 0; total < length2;) { int bytesToRead = (int) Math.min(buffer.length, length2 - total); int bytes = IoBridge.read(fd3, buffer, 0, bytesToRead); int bytes = IoBridge.read(dupedFd, buffer, 0, bytesToRead); if (bytes < 0) { break; } else { Loading @@ -2504,15 +2502,13 @@ public class MediaPlayer implements SubtitleController.Listener Log.e(TAG, e.getMessage(), e); return MEDIA_INFO_TIMED_TEXT_ERROR; } finally { if (is != null) { try { is.close(); } catch (IOException e) { Libcore.os.close(dupedFd); } catch (ErrnoException e) { Log.e(TAG, e.getMessage(), e); } } } } public void run() { int res = addTrack(); Loading Loading
media/java/android/media/MediaPlayer.java +8 −12 Original line number Diff line number Diff line Loading @@ -2446,9 +2446,9 @@ public class MediaPlayer implements SubtitleController.Listener throw new IllegalArgumentException("Illegal mimeType for timed text source: " + mime); } FileDescriptor fd2; final FileDescriptor dupedFd; try { fd2 = Libcore.os.dup(fd); dupedFd = Libcore.os.dup(fd); } catch (ErrnoException ex) { Log.e(TAG, ex.getMessage(), ex); throw new RuntimeException(ex); Loading @@ -2473,7 +2473,6 @@ public class MediaPlayer implements SubtitleController.Listener mIndexTrackPairs.add(Pair.<Integer, SubtitleTrack>create(null, track)); } final FileDescriptor fd3 = fd2; final long offset2 = offset; final long length2 = length; final HandlerThread thread = new HandlerThread( Loading @@ -2483,14 +2482,13 @@ public class MediaPlayer implements SubtitleController.Listener Handler handler = new Handler(thread.getLooper()); handler.post(new Runnable() { private int addTrack() { InputStream is = null; final ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { Libcore.os.lseek(fd3, offset2, OsConstants.SEEK_SET); Libcore.os.lseek(dupedFd, offset2, OsConstants.SEEK_SET); byte[] buffer = new byte[4096]; for (long total = 0; total < length2;) { int bytesToRead = (int) Math.min(buffer.length, length2 - total); int bytes = IoBridge.read(fd3, buffer, 0, bytesToRead); int bytes = IoBridge.read(dupedFd, buffer, 0, bytesToRead); if (bytes < 0) { break; } else { Loading @@ -2504,15 +2502,13 @@ public class MediaPlayer implements SubtitleController.Listener Log.e(TAG, e.getMessage(), e); return MEDIA_INFO_TIMED_TEXT_ERROR; } finally { if (is != null) { try { is.close(); } catch (IOException e) { Libcore.os.close(dupedFd); } catch (ErrnoException e) { Log.e(TAG, e.getMessage(), e); } } } } public void run() { int res = addTrack(); Loading