Coder Social home page Coder Social logo

Comments (4)

4gus71n avatar 4gus71n commented on July 17, 2024

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

from ffmpegmediaplayer.

pfaffenrodt avatar pfaffenrodt commented on July 17, 2024

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)

from ffmpegmediaplayer.

pfaffenrodt avatar pfaffenrodt commented on July 17, 2024

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);
    }
}

from ffmpegmediaplayer.

wseemann avatar wseemann commented on July 17, 2024

This should be fixed in version 1.0.1.

from ffmpegmediaplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.