appunite / AndroidFFmpeg

[DEPRECATED] FFmpeg build for android random architectures with example jni
Apache License 2.0
1.07k stars 471 forks source link

App crashes (SIGSEGV) upon exiting VideoActivity while rtsp stream is loading #79

Open luukSchip opened 10 years ago

luukSchip commented 10 years ago

If back button is pressed while a video stream is loading, the app crashes. You can reproduce this by opening an rtsp stream (e.g. rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov) in FFmpegExample and pressing back button while the stream is loading.

I get the following output:

09-11 14:45:11.150: I/player.c(11701): player_read_from_stream queue interrupt stop
09-11 14:45:11.155: I/player.c(11701): player_decode stop[0]
09-11 14:45:11.155: I/player.c(11701): player_decode flush[0]
09-11 14:45:11.155: I/player.c(11701): player_decode flushing playback[0]
09-11 14:45:11.155: I/player.c(11701): player_decode_video_flush flushing
09-11 14:45:11.155: I/player.c(11701): player_decode flushed playback[0]
09-11 14:45:11.155: I/player.c(11701): player_decode stopping stream
09-11 14:45:13.365: D/AbsListView(11701): unregisterIRListener() is called 
09-11 14:45:15.230: D/AbsListView(11701): unregisterIRListener() is called 
09-11 14:45:16.540: D/AbsListView(11701): unregisterIRListener() is called 
09-11 14:45:19.745: D/AbsListView(11701): onVisibilityChanged() is called, visibility : 4
09-11 14:45:19.745: D/AbsListView(11701): unregisterIRListener() is called 
09-11 14:45:19.760: D/ProgressBar(11701): setProgressDrawable mProgressDrawable = null, d = android.graphics.drawable.LayerDrawable@42a74ce8needUpdate = false
09-11 14:45:19.760: D/ProgressBar(11701): setProgressDrawable drawableHeight = 12
09-11 14:45:19.760: D/ProgressBar(11701): setProgress = 0
09-11 14:45:19.760: D/ProgressBar(11701): setProgress = 0, fromUser = false
09-11 14:45:19.760: D/ProgressBar(11701): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
09-11 14:45:19.760: D/AbsSeekBar(11701): AbsSeekBar Constructor: misSeebarAnimationAvailable = false
09-11 14:45:19.765: D/ProgressBar(11701): setProgress = 0
09-11 14:45:19.765: D/ProgressBar(11701): setProgress = 0, fromUser = false
09-11 14:45:19.765: D/ProgressBar(11701): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
09-11 14:45:19.855: E/ffmpeg(11701): 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
09-11 14:45:19.855: E/ffmpeg(11701): 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
09-11 14:45:19.905: D/ProgressBar(11701): updateDrawableBounds: left = 0
09-11 14:45:19.905: D/ProgressBar(11701): updateDrawableBounds: top = 0
09-11 14:45:19.905: D/ProgressBar(11701): updateDrawableBounds: right = 144
09-11 14:45:19.905: D/ProgressBar(11701): updateDrawableBounds: bottom = 144
09-11 14:45:20.835: D/AbsListView(11701): onVisibilityChanged() is called, visibility : 0
09-11 14:45:20.835: D/AbsListView(11701): unregisterIRListener() is called 
09-11 14:45:20.920: D/AbsListView(11701): unregisterIRListener() is called 
09-11 14:45:22.090: E/ffmpeg(11701): Estimating duration from bitrate, this may be inaccurate
09-11 14:45:22.100: I/player.c(11701): player_decode stop[0]
09-11 14:45:22.100: I/player.c(11701): player_decode flush[0]
09-11 14:45:22.100: I/player.c(11701): player_decode flushing playback[0]
09-11 14:45:22.100: I/player.c(11701): player_decode_video_flush flushing
09-11 14:45:22.105: I/player.c(11701): player_decode flushed playback[0]
09-11 14:45:22.105: I/player.c(11701): player_decode stopping stream
09-11 14:45:22.105: A/libc(11701): Fatal signal 11 (SIGSEGV) at 0x00000344 (code=1), thread 12035 (AsyncTask #4)

Tested on a Samsung Galaxy S3 running Android 4.3

ksc91u commented 9 years ago

In ffmpeg_mediaplayer.c, stop() won't wait player_decode thread to end. Sometimes JVM will free resources of player, but the player_decode thread might still be running.

Thus cause JNI crash inside player_decode.

Suggest pthread_join(state->decoder_thread as in reset().