[Android] VideoPlayer: fix handleHardwareAccelerationError
Thomas Guillem
git at videolan.org
Wed Dec 2 18:43:41 CET 2015
vlc-ports/android | branch: 1.7.x | Thomas Guillem <thomas at gllm.fr> | Wed Dec 2 18:41:10 2015 +0100| [883c48a8d9ebffe3fd2b77ace4fc13f2690066ef] | committer: Thomas Guillem
VideoPlayer: fix handleHardwareAccelerationError
loadMedia was messing with current state and could cause a NPE.
Directly restart using mService and seek at previous position.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=883c48a8d9ebffe3fd2b77ace4fc13f2690066ef
---
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index d5379d5..c2e8e25 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1537,11 +1537,20 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mSwitchingView)
return;
Toast.makeText(this, R.string.hardware_acceleration_error, Toast.LENGTH_LONG).show();
- mService.removeCallback(this);
+ final boolean wasPaused = !mService.isPlaying();
+ final long oldTime = mService.getTime();
mService.stop();
- if(!isFinishing())
- loadMedia();
+ if(!isFinishing()) {
+ final MediaWrapper mw = new MediaWrapper(mUri);
+ if (wasPaused)
+ mw.addFlags(MediaWrapper.MEDIA_PAUSED);
+ mw.addFlags(MediaWrapper.MEDIA_NO_HWACCEL);
+ mw.addFlags(MediaWrapper.MEDIA_VIDEO);
+ mService.load(mw);
+ if (oldTime > 0)
+ seek(oldTime);
}
+ }
private void handleVout(int voutCount) {
final IVLCVout vlcVout = mService.getVLCVout();
More information about the Android
mailing list