[Android] Only setMedia when we have to

Geoffrey Métais git at videolan.org
Mon Apr 4 17:28:27 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr  4 17:26:29 2016 +0200| [72c0f919f3d679db65b4939a22fbe76387579466] | committer: Geoffrey Métais

Only setMedia when we have to

> https://code.videolan.org/videolan/vlc-android/commit/72c0f919f3d679db65b4939a22fbe76387579466
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index b0b96b6..de11f19 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1691,7 +1691,8 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
         final Media media = new Media(VLCInstance.get(), mw.getUri());
         VLCOptions.setMediaOptions(media, this, flags | mw.getFlags());
         media.setEventListener(mMediaListener);
-        mMediaPlayer.setMedia(media);
+        if (mMediaPlayer.getMedia() == null || !mw.getUri().equals(mMediaPlayer.getMedia().getUri()))
+            mMediaPlayer.setMedia(media);
         media.release();
         if (mw .getType() != MediaWrapper.TYPE_VIDEO || mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO) || isVideoPlaying()) {
             mMediaPlayer.setEqualizer(VLCOptions.getEqualizer(this));



More information about the Android mailing list