Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal signal 11 (SIGSEGV) #29

Closed
radzio opened this issue Jan 28, 2015 · 4 comments
Closed

Fatal signal 11 (SIGSEGV) #29

radzio opened this issue Jan 28, 2015 · 4 comments

Comments

@radzio
Copy link

radzio commented Jan 28, 2015

Hi,

When user is clicking fast (any many times) on play button demo app is crashing.

12976-13577/wseemann.media.fmpdemo A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x630040 in tid 13577 (n.media.fmpdemo)

I was testing it with many streams with same result.

@4gus71n
Copy link

4gus71n commented May 27, 2015

Did you found a workaround for this bug? I've the same issue!

@pfaffenrodt
Copy link

same issue on clicking fast

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xf8df41cc
Stack frame I/DEBUG   (  402):     #00 pc 0000654e  /data/app/package-2/lib/arm/libffmpeg_mediaplayer_jni.so (MediaPlayer::initAudioTrack(int, int, int)+45)
Stack frame I/DEBUG   (  402):     #01 pc 00006f93  /data/app/package-2/lib/arm/libffmpeg_mediaplayer_jni.so (stream_component_open+114)
Stack frame I/DEBUG   (  402):     #02 pc 0000712f  /data/app/package-2/lib/arm/libffmpeg_mediaplayer_jni.so (player_prepare+366)
Stack frame I/DEBUG   (  402):     #03 pc 00012e9b  /system/lib/libc.so (__pthread_start(void*)+30)
Stack frame I/DEBUG   (  402):     #04 pc 00010e73  /system/lib/libc.so (__start_thread+6)

@pfaffenrodt
Copy link

Source of evil:
If invoking stop, it will only change the state. the player_prepare is still running and may produce some nullpointer.(ffmpeg_mediaplay.c)

Stupid Java solution: prevent calls until prepared callback is called.
Sample https://github.com/pfaffenrodt/TestFFmpegMediaPlayer

Just realized, stop is only in states after prepare possible:

mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED |
                    MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE )

Inside the state MEDIA_PLAYER_PREPARING invoke stop() will throw an Error.
ErrorListener in most cases like in the description invoke release(). But prepare is still running.

mp.setOnErrorListener(new FFmpegMediaPlayer.OnErrorListener() {

    @Override
    public boolean onError(FFmpegMediaPlayer mp, int what, int extra) {
        mp.release();
        return false;
    }
});
static void
wseemann_media_FFmpegMediaPlayer_release(JNIEnv *env, jobject thiz)
{
    __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "release");
    //decVideoSurfaceRef(env, thiz);
    MediaPlayer* mp = setMediaPlayer(env, thiz, 0);
    if (mp != NULL) {
        // this prevents native callbacks after the object is released
        JNIMediaPlayerListener *listener = (JNIMediaPlayerListener *) mp->getListener();
        delete listener;
        mp->setListener(0);
        mp->disconnect();

        delete mp;
        setMediaPlayer(env, thiz, 0);
    }
}

@wseemann
Copy link
Owner

This should be fixed in version 1.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants