[Android] Don't switch to audioMode in case of HardwareAccelerationError
Thomas Guillem
git at videolan.org
Tue Oct 21 17:44:13 CEST 2014
vlc-ports/android | branch: master | Thomas Guillem <tom at gllm.fr> | Tue Oct 21 17:11:19 2014 +0200| [408bf6b7c2aa0ebddecc48c853b3c0db55cac168] | committer: Jean-Baptiste Kempf
Don't switch to audioMode in case of HardwareAccelerationError
If a hardware decoder crashed at the very beginning, a HardwareAccelerationError
dialog was shown while activity switched to audioMode and leaded to a crash.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=408bf6b7c2aa0ebddecc48c853b3c0db55cac168
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 7 +++++++
1 file changed, 7 insertions(+)
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 dc53c59..382898e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -195,6 +195,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
* For uninterrupted switching between audio and video mode
*/
private boolean mSwitchingView;
+ private boolean mHardwareAccelerationError;
private boolean mEndReached;
private boolean mCanSeek;
@@ -406,6 +407,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
startLoadingAnimation();
mSwitchingView = false;
+ mHardwareAccelerationError = false;
mEndReached = false;
// Clear the resume time, since it is only used for resumes in external
@@ -1109,6 +1111,9 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
}
private void handleHardwareAccelerationError() {
+ mHardwareAccelerationError = true;
+ if (mSwitchingView)
+ return;
mLibVLC.stop();
AlertDialog dialog = new AlertDialog.Builder(VideoPlayerActivity.this)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@@ -1150,6 +1155,8 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
}
private void switchToAudioMode() {
+ if (mHardwareAccelerationError)
+ return;
mSwitchingView = true;
// Show the MainActivity if it is not in background.
if (getIntent().getAction() != null
More information about the Android
mailing list