Skip to content

Commit

Permalink
FIXME: avoid ANR when audiotrack is ko
Browse files Browse the repository at this point in the history
proper fix to deal with it at avos level is required
  • Loading branch information
courville committed Jan 13, 2025
1 parent d9d5915 commit 3dbb4e9
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions src/com/archos/medialib/AvosMediaPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,27 @@ public void setOnSubtitleListener(OnSubtitleListener listener) {
}

private native void nativeRelease();
public void release() {
stayAwake(false);
updateSurfaceScreenOn();
mOnPreparedListener = null;
mOnCompletionListener = null;
mOnInfoListener = null;
mOnErrorListener = null;
mOnBufferingUpdateListener = null;
mOnRelativePositionUpdateListener = null;
mOnSeekCompleteListener = null;
mOnVideoSizeChangedListener = null;
mOnNextTrackListener = null;
mOnSubtitleListener = null;
nativeRelease();
if (mSmbProxy != null) {
mSmbProxy.stop();
mSmbProxy = null;
}

public synchronized void release() {
new Thread(() -> {
stayAwake(false);
updateSurfaceScreenOn();
mOnPreparedListener = null;
mOnCompletionListener = null;
mOnInfoListener = null;
mOnErrorListener = null;
mOnBufferingUpdateListener = null;
mOnRelativePositionUpdateListener = null;
mOnSeekCompleteListener = null;
mOnVideoSizeChangedListener = null;
mOnNextTrackListener = null;
mOnSubtitleListener = null;
nativeRelease();
if (mSmbProxy != null) {
mSmbProxy.stop();
mSmbProxy = null;
}
}).start();
}

public native void prepareAsync() throws IllegalStateException;
Expand All @@ -345,9 +348,12 @@ public void start() throws IllegalStateException {
}

private native void nativeStop() throws IllegalStateException;
public void stop() throws IllegalStateException {
stayAwake(false);
nativeStop();

public synchronized void stop() throws IllegalStateException {
new Thread(() -> {
stayAwake(false);
nativeStop();
}).start();
}

private native void nativePause() throws IllegalStateException;
Expand Down

0 comments on commit 3dbb4e9

Please sign in to comment.