bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.5k stars 8.12k forks source link

voud_display_overlay_l: NULL native_window #153

Closed thuantran closed 9 years ago

thuantran commented 9 years ago

Hi there,

I'm having this error using IjkMediaPlayer in my app and I have no video during playback only audio.

Before trying Ijk I used vitamio latest version from git and it works but it does have its issue when I try to switch MediaPlayer objects (check my code) due to a bug causing it not to release surface holder correctly.

Tested on both Nexus 5 and 7 (2013) running Lollipop 5.0.1. ijkplayer is compiled with latest sdk 24.0.2 and ndk r10d

Do you have any idea?

I attach the log and source below

01-18 03:42:38.844    3672-3694/com.vanilla.eventapp D/OpenGLRenderer? Render dirty regions requested: true
01-18 03:42:38.849    3672-3672/com.vanilla.eventapp D/Atlas? Validating map...
01-18 03:42:38.882    3672-3694/com.vanilla.eventapp I/Adreno-EGL? <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b
01-18 03:42:38.883    3672-3694/com.vanilla.eventapp I/OpenGLRenderer? Initialized EGL, version 1.4
01-18 03:42:38.895    3672-3694/com.vanilla.eventapp D/OpenGLRenderer? Enabling debug mode 0
01-18 03:42:42.013    3672-3694/com.vanilla.eventapp D/OpenGLRenderer? endAllStagingAnimators on 0xa350e180 (RippleDrawable) with handle 0xa3607bf0
01-18 03:42:42.521    3672-3672/com.vanilla.eventapp E/MediaPlayer? Should have subtitle controller already set
01-18 03:42:42.815    3672-3688/com.vanilla.eventapp W/MediaPlayer? info/warning (3, 0)
01-18 03:42:44.865    3672-3672/com.vanilla.eventapp W/linker? libijkffmpeg.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
01-18 03:42:44.868    3672-3672/com.vanilla.eventapp W/IJKMEDIA? java.nio.ByteBuffer class loaded
01-18 03:42:44.869    3672-3672/com.vanilla.eventapp I/IJKMEDIA? MediaCodec: API-21
01-18 03:42:44.869    3672-3672/com.vanilla.eventapp W/IJKMEDIA? android.media.MediaCodec$BufferInfo class loaded
01-18 03:42:44.869    3672-3672/com.vanilla.eventapp W/IJKMEDIA? android.media.MediaCodec class loaded
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_native_init
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_native_setup
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_create_from_android()
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_format_callback(0xa3447875, 0x3003c2)
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_format_callback()=void
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_android_set_mediacodec_select_callback()
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_mediacodec_select_callback
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_android_set_mediacodec_select_callback()=void
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_setOverlayFormat
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_overlay_format(RV16(0x36315652))
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_overlay_format()=void
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_setVideoSurface
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0xbebea150)
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_surface()
01-18 03:42:44.871    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0xbebea150)=void
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_reset
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_release
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_surface()
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)=void
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()=void
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_native_setup
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_create_from_android()
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_format_callback(0xa3447875, 0x10046e)
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_format_callback()=void
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_android_set_mediacodec_select_callback()
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_mediacodec_select_callback
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_android_set_mediacodec_select_callback()=void
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_dec_ref(): ref=0
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()=void
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_setDataSourceAndHeaders
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp V/IJKMEDIA? setDataSource: path http://123.29.75.131:1935/vod/sample.mp4/playlist.m3u8
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_data_source(url="http://123.29.75.131:1935/vod/sample.mp4/playlist.m3u8")
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_data_source(url="http://123.29.75.131:1935/vod/sample.mp4/playlist.m3u8")=0
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_prepareAsync
01-18 03:42:44.872    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_prepare_async()
01-18 03:42:44.872    3672-3955/com.vanilla.eventapp I/IJKMEDIA? SDL_RunThread: [3955] ff_msg_loop
01-18 03:42:44.872    3672-3955/com.vanilla.eventapp W/IJKMEDIA? message_loop
01-18 03:42:44.873    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_FLUSH:
01-18 03:42:44.874    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_prepare_async()=0
01-18 03:42:44.877    3672-3957/com.vanilla.eventapp I/IJKMEDIA? SDL_RunThread: [3957] ff_read
01-18 03:42:44.879    3672-3956/com.vanilla.eventapp I/IJKMEDIA? SDL_RunThread: [3956] ff_vout
01-18 03:42:44.879    3672-3956/com.vanilla.eventapp D/IJKMEDIA? ffpipenode_create_video_output_from_android_mediacodec()
01-18 03:42:45.088    3672-3957/com.vanilla.eventapp I/IJKMEDIA? max_frame_duration: 10.000
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? Input #0, hls,applehttp, from 'http://123.29.75.131:1935/vod/sample.mp4/playlist.m3u8':
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? Duration:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 00:09:56.46
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? , start:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 0.000000
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? , bitrate:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 0 kb/s
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Program 0
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? Metadata:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? variant_bitrate :
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 1009411
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Stream #0:0
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? : Data: timed_id3 (ID3  / 0x20334449)
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Metadata:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? variant_bitrate :
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 1009411
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Stream #0:1
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? : Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 424x240
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? ,
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 24 fps,
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 24 tbr,
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 90k tbn,
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 48 tbc
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Metadata:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? variant_bitrate :
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 1009411
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Stream #0:2
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? : Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 100 kb/s
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.089  3672: 3957 I/IJKMEDIA ]
    Metadata:
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? variant_bitrate :
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? 1009411
01-18 03:42:45.089    3672-3957/com.vanilla.eventapp I/IJKMEDIA? [ 01-18 03:42:45.092  3672: 3957 I/IJKMEDIA ]
    SDL_Android_AudioTrack: CHANNEL_OUT_STEREO
01-18 03:42:45.092    3672-3957/com.vanilla.eventapp I/IJKMEDIA? SDL_Android_AudioTrack: ENCODING_PCM_16BIT
01-18 03:42:45.096    3672-3957/com.vanilla.eventapp I/IJKMEDIA? SDL_Android_AudioTrack_new: init volume as 1.000000/(0.000000,1.000000)
01-18 03:42:45.097    3672-3957/com.vanilla.eventapp I/IJKMEDIA? AudioCodec: avcodec, aac
01-18 03:42:45.098    3672-3962/com.vanilla.eventapp I/IJKMEDIA? SDL_RunThread: [3962] ff_aout_android
01-18 03:42:45.101    3672-3963/com.vanilla.eventapp I/IJKMEDIA? SDL_RunThread: [3963] ff_audio_dec
01-18 03:42:45.103    3672-3963/com.vanilla.eventapp D/IJKMEDIA? ffp_toggle_buffering_l: start
01-18 03:42:45.104    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_BUFFERING_START:
01-18 03:42:45.105    3672-3672/com.vanilla.eventapp I/tv.danmaku.ijk.media.player.IjkMediaPlayer? Info (701,0)
01-18 03:42:45.110    3672-3957/com.vanilla.eventapp I/IJKMEDIA? VideoCodec: avcodec, h264
01-18 03:42:45.110    3672-3957/com.vanilla.eventapp I/IJKMEDIA? fps: 24.000000 (normal)
01-18 03:42:45.110    3672-3957/com.vanilla.eventapp I/IJKMEDIA? fps: 24.000000 (normal)
01-18 03:42:45.111    3672-3955/com.vanilla.eventapp W/IJKMEDIA? ijkmp_get_msg: FFP_MSG_PREPARED
01-18 03:42:45.111    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_PREPARED:
01-18 03:42:45.111    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_VIDEO_SIZE_CHANGED: 424, 240
01-18 03:42:45.111    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_SAR_CHANGED: 0, 1
01-18 03:42:45.112    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_start
01-18 03:42:45.112    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_start()
01-18 03:42:45.112    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_start()=0
01-18 03:42:45.112    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_seekTo
01-18 03:42:45.112    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_seek_to(1713)
01-18 03:42:45.112    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_seek_to(1713)=0
01-18 03:42:45.114    3672-3955/com.vanilla.eventapp W/IJKMEDIA? ijkmp_get_msg: FFP_REQ_START
01-18 03:42:45.114    3672-3955/com.vanilla.eventapp D/IJKMEDIA? ijkmp_get_msg: FFP_REQ_START: start on fly
01-18 03:42:45.114    3672-3955/com.vanilla.eventapp W/IJKMEDIA? ijkmp_get_msg: FFP_REQ_SEEK
01-18 03:42:45.114    3672-3955/com.vanilla.eventapp E/IJKMEDIA? stream_seek 1713000(1713) + 0,
01-18 03:42:45.114    3672-3955/com.vanilla.eventapp D/IJKMEDIA? ijkmp_get_msg: FFP_REQ_SEEK: seek to 1713
01-18 03:42:45.115    3672-3955/com.vanilla.eventapp W/IJKMEDIA? ijkmp_get_msg: FFP_MSG_SEEK_COMPLETE
01-18 03:42:45.115    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_SEEK_COMPLETE:
01-18 03:42:45.117    3672-3969/com.vanilla.eventapp I/IJKMEDIA? SDL_RunThread: [3969] ff_video_dec
01-18 03:42:45.205    3672-3969/com.vanilla.eventapp W/IJKMEDIA? SDL_VoutFFmpeg_CreateOverlay(w=424, h=240, fmt=RV32(0x32335652, dp=0xac390910)
01-18 03:42:45.205    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_VIDEO_SIZE_CHANGED: 424, 240
01-18 03:42:45.212    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_VIDEO_SIZE_CHANGED: 424, 240
01-18 03:42:45.212    3672-3969/com.vanilla.eventapp W/IJKMEDIA? SDL_VoutFFmpeg_CreateOverlay(w=424, h=240, fmt=RV32(0x32335652, dp=0xac390910)
01-18 03:42:45.213    3672-3969/com.vanilla.eventapp W/IJKMEDIA? SDL_VoutFFmpeg_CreateOverlay(w=424, h=240, fmt=RV32(0x32335652, dp=0xac390910)
01-18 03:42:45.214    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_VIDEO_SIZE_CHANGED: 424, 240
01-18 03:42:45.629    3672-3957/com.vanilla.eventapp D/IJKMEDIA? ffp_toggle_buffering_l: end
01-18 03:42:45.631    3672-3955/com.vanilla.eventapp W/IJKMEDIA? FFP_MSG_BUFFERING_END:
01-18 03:42:45.631    3672-3672/com.vanilla.eventapp I/tv.danmaku.ijk.media.player.IjkMediaPlayer? Info (702,0)
01-18 03:42:45.674    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.716    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.757    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.798    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.840    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.882    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.923    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:45.965    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.007    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.048    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.090    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.132    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.173    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.215    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.257    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.298    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.340    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.382    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.423    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.465    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.507    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.548    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.590    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.632    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.673    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.715    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.757    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.798    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.840    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.882    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.923    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:46.965    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.007    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.048    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.090    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.132    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.173    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.215    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.257    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.298    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.340    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.382    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.423    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.465    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.507    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.548    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.590    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.632    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.673    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.715    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.757    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.798    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.840    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.882    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.923    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:47.965    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.007    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.048    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.090    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.132    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.173    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.215    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.257    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.298    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.340    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.382    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.423    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.465    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.507    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.548    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.590    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.632    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.674    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.715    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.757    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.798    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.840    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.882    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.924    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:48.967    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.010    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.048    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.090    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.132    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.173    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.215    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.257    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.298    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.340    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.382    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.423    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.465    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.507    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.550    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.590    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.599    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_setVideoSurface
01-18 03:42:49.599    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)
01-18 03:42:49.599    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_surface()
01-18 03:42:49.599    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)=void
01-18 03:42:49.632    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.673    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.715    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.757    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.798    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.840    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.882    3672-3956/com.vanilla.eventapp E/IJKMEDIA? voud_display_overlay_l: NULL native_window
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_stop()
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_stop()=0
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_reset
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_release
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_surface()
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)=void
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()
01-18 03:42:49.887    3672-3672/com.vanilla.eventapp W/IJKMEDIA? wait for read_tid
01-18 03:42:49.888    3672-3955/com.vanilla.eventapp W/IJKMEDIA? message_loop exit
01-18 03:42:49.905    3672-3962/com.vanilla.eventapp W/art? Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[22,tid=3962,Native,Thread*=0xb3b16400,peer=0x12e38b60,"Thread-13226"]
01-18 03:42:49.930    3672-3957/com.vanilla.eventapp W/art? Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[20,tid=3957,Native,Thread*=0xaf6bd000,peer=0x12c680e0,"Thread-13224"]
01-18 03:42:49.931    3672-3672/com.vanilla.eventapp W/IJKMEDIA? wait for video_refresh_tid
01-18 03:42:49.935    3672-3672/com.vanilla.eventapp E/IJKMEDIA? SDL_Overlay(ffmpeg): overlay_free_l(0xa002a040)
01-18 03:42:49.935    3672-3672/com.vanilla.eventapp E/IJKMEDIA? SDL_Overlay(ffmpeg): overlay_free_l(0xa002a070)
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp E/IJKMEDIA? SDL_Overlay(ffmpeg): overlay_free_l(0xa002a0a0)
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()=void
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_native_setup
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_create_from_android()
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_format_callback(0xa3447875, 0x200476)
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_format_callback()=void
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_android_set_mediacodec_select_callback()
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_mediacodec_select_callback
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_android_set_mediacodec_select_callback()=void
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_dec_ref(): ref=0
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()=void
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? IjkMediaPlayer_release
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp D/IJKMEDIA? ffpipeline_set_surface()
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_set_android_surface(surface=0x0)=void
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()=void
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_dec_ref(): ref=0
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()
01-18 03:42:49.936    3672-3672/com.vanilla.eventapp W/IJKMEDIA? ijkmp_shutdown_l()=void
    private MediaPlayer mHwMp;
    private IjkMediaPlayer mSwMp;

    private void createMediaPlayer(boolean useSwDecoder) {
        destroyMediaPlayer();
        mTry = 0;

        switch (mDecoder) {
            case DECODER_AUTO:
                if (useSwDecoder) {
                    createSwDecoder();
                    mBtnDecoder.setText("Auto (SW)");
                } else {
                    createHwDecoder();
                    mBtnDecoder.setText("Auto (HW)");
                }
                break;
            case DECODER_HW:
                createHwDecoder();
                mBtnDecoder.setText("HW");
                break;
            case DECODER_SW:
                createSwDecoder();
                mBtnDecoder.setText("SW");
                break;
        }
        playVideo();
    }

    private void createHwDecoder() {
        mHwMp = new MediaPlayer();
        mHwMp.setOnCompletionListener(this);
        mHwMp.setOnErrorListener(this);
        mHwMp.setOnPreparedListener(this);
        mHwMp.setOnVideoSizeChangedListener(this);
        if (mSurfaceReady) {
            mHwMp.setDisplay(mSurfaceHolder);
        }
    }

    private void createSwDecoder() {
        mSwMp = new IjkMediaPlayer();
        mSwMp.setOverlayFormat(AvFourCC.SDL_FCC_RV32);
        mSwMp.setLogEnabled(false);
        mSwMp.setOnCompletionListener(this);
        mSwMp.setOnErrorListener(this);
        mSwMp.setOnPreparedListener(this);
        mSwMp.setOnVideoSizeChangedListener(this);
        if (mSurfaceReady) {
            mSwMp.setDisplay(mSurfaceHolder);
        }
    }

    private void destroyMediaPlayer() {
        if (mHwMp != null) {
            mHwMp.stop();
            mHwMp.reset();
            mHwMp.release();
            mHwMp = null;
        }
        if (mSwMp != null) {
            mSwMp.stop();
            mSwMp.reset();
            mSwMp.release();
            mSwMp = null;
        }
        mPlayerPrepared = false;
        mPlayVideo = false;
    }

     /**
     * Schedule and prepare video to play only when surface is ready
     */
    private void playVideo() {
        if (!mSurfaceReady) {
            return;
        }

        mPlayerPrepared = false;

        // TODO remove h265 code
        //String url = "http://video.mytvnet.vn/tvshow/datafiles/201412/18/football/playlist.m3u8";
        if (mSwMp == null) {
            try {
                mHwMp.reset();
                //mHwMp.setDataSource(url);
                mHwMp.setDataSource(getIntent().getStringExtra(ActivityBasicPlayer.ARG_VIDEO_URL));
                mHwMp.prepareAsync();
            } catch (Exception e) {
                Log.e(TAG, "Unable to setDataSource", e);
            }
        } else {
            try {
                mSwMp.reset();
                //mSwMp.setDataSource(url);
                mSwMp.setDataSource(getIntent().getStringExtra(ActivityBasicPlayer.ARG_VIDEO_URL));
                mSwMp.prepareAsync();
            } catch (Exception e) {
                Log.e(TAG, "Unable to setDataSource", e);
            }
        }
        mPlayVideo = true;
    }
bbcallen commented 9 years ago

The function reset() also resets the surface/surfaceHolder. Setup everything after reset(), or don't call reset(), in playVideo().

bbcallen commented 9 years ago

BTW: There is a MediaPlayer wrapper named AndroidMediaPlayer in ijk, for the convenience of switching between them.

thuantran commented 9 years ago

Thanks it's working now. And yes I knew about AndroidMediaPlayer class, was planning to do it after I manage to fix this issue here.

Also is there anyway to make the logging less verbose. I used mSwMp.setLogEnabled(false); and it's still a lot.

thuantran commented 9 years ago

Spoke too soon, I'm running into the same issue (releasing SurfaceHolder is too slow) I had with vitamio when switching between default device MediaPlayer and IjkMediaPlayer object. Any idea?

In any case, I already feel like your library is a better implementation compared to vitamio, so I plan to stick with it. Hopefully I can sort everything out with it.

01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_stop()
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_stop()=0
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ IjkMediaPlayer_reset
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ IjkMediaPlayer_release
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_set_android_surface(surface=0x0)
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp D/IJKMEDIA﹕ ffpipeline_set_surface()
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_set_android_surface(surface=0x0)=void
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()
01-18 14:28:27.708  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ wait for read_tid
01-18 14:28:27.708  29015-29394/com.vanilla.eventapp W/IJKMEDIA﹕ message_loop exit
01-18 14:28:27.721  29015-29415/com.vanilla.eventapp W/art﹕ Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[21,tid=29415,Native,Thread*=0xb3c13400,peer=0x12c790e0,"Thread-1610"]
01-18 14:28:27.744  29015-29396/com.vanilla.eventapp W/art﹕ Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[19,tid=29396,Native,Thread*=0xaf5bd000,peer=0x12c26320,"Thread-1608"]
01-18 14:28:27.745  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ wait for video_refresh_tid
01-18 14:28:27.753  29015-29015/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Overlay(ffmpeg): overlay_free_l(0xa012a040)
01-18 14:28:27.753  29015-29015/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Overlay(ffmpeg): overlay_free_l(0xa012a070)
01-18 14:28:27.753  29015-29015/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Overlay(ffmpeg): overlay_free_l(0xa012a0a0)
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()=void
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ IjkMediaPlayer_native_setup
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp D/IJKMEDIA﹕ ffpipeline_create_from_android()
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_set_format_callback(0xa34c5875, 0x20046e)
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_set_format_callback()=void
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_android_set_mediacodec_select_callback()
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp D/IJKMEDIA﹕ ffpipeline_set_mediacodec_select_callback
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_android_set_mediacodec_select_callback()=void
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_dec_ref(): ref=0
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()=void
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ IjkMediaPlayer_release
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_set_android_surface(surface=0x0)
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp D/IJKMEDIA﹕ ffpipeline_set_surface()
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_set_android_surface(surface=0x0)=void
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()=void
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_dec_ref(): ref=0
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()
01-18 14:28:27.757  29015-29015/com.vanilla.eventapp W/IJKMEDIA﹕ ijkmp_shutdown_l()=void
01-18 14:28:27.761      176-538/? E/BufferQueueProducer? [SurfaceView] connect(P): already connected (cur=2 req=3)
01-18 14:28:27.761      183-881/? E/MediaPlayerService? setVideoSurfaceTexture failed: -22
01-18 14:28:27.761      183-881/? D/NuPlayerDriver? reset(0xb380f400)
01-18 14:28:27.761    183-29443/? D/NuPlayerDriver? notifyResetComplete(0xb380f400)
01-18 14:28:27.762  29015-29015/com.vanilla.eventapp E/EventApp﹕ Error in playVideo
    java.lang.IllegalStateException
            at android.media.MediaPlayer.prepareAsync(Native Method)
            at tv.danmaku.ijk.media.player.AndroidMediaPlayer.prepareAsync(AndroidMediaPlayer.java:108)
            at com.vanilla.eventapp.gui.ActivityBasicPlayer.playVideo(ActivityBasicPlayer.java:417)
            at com.vanilla.eventapp.gui.ActivityBasicPlayer.createMediaPlayer(ActivityBasicPlayer.java:344)
            at com.vanilla.eventapp.gui.ActivityBasicPlayer.onClick(ActivityBasicPlayer.java:106)
            at android.view.View.performClick(View.java:4756)
            at android.view.View$PerformClick.run(View.java:19749)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
bbcallen commented 9 years ago

All native log are output through macro ALOG... in ijkutil/android/loghelp.h. Modify it to what you want.

According to the log, you were creating a MediaPlayer before an IjkMediaPlayer is released?

thuantran commented 9 years ago

Nah, I have already called released on IjkMediaPlayer object please check my createMediaPlayer method, it calls my destroyMediaPlayer method first then will create a new MediaPlayer object according to previously set mDecoder variable.

The problem here is sometimes, it takes too long for for the surface to get released and I will get this error in this case. I have updated the log in my previous post to include log from the time when I call destroyMediaPlayer in createMediaPlayer. Please check it out.

bbcallen commented 9 years ago

IjkMediaPlayer is supposed to hold no more surface after IjkMediaPlayer.release() return.

Try getHolder().setFormat() to force the surface to be recreated. I guess the problem is system MediaPlayer doesn't accept the surface previously configured by ijkplayer.

thuantran commented 9 years ago

I tried

private void destroyMediaPlayer() {
        if (mMp != null) {
            mMp.release();
            mMp.setDisplay(null);
            mMp = null;
            mSurfaceHolder.setFormat(ImageFormat.YV12);
        }
    }

but it still has the same problem and with surfaceHolder.setFormat() with some format of PixelFormat or ImageFormat, ijkplayer runs into a new issue

01-22 12:57:14.485  29804-30156/com.vanilla.eventapp E/Surface﹕ dequeueBuffer failed (No such device)
01-22 12:57:14.485  29804-30156/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Android_NativeWindow_display_l: ANativeWindow_lock: failed -19
01-22 12:57:14.536  29804-30156/com.vanilla.eventapp E/Surface﹕ dequeueBuffer failed (No such device)
01-22 12:57:14.536  29804-30156/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Android_NativeWindow_display_l: ANativeWindow_lock: failed -19
01-22 12:57:14.586  29804-30156/com.vanilla.eventapp E/Surface﹕ dequeueBuffer failed (No such device)
01-22 12:57:14.586  29804-30156/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Android_NativeWindow_display_l: ANativeWindow_lock: failed -19
01-22 12:57:14.637  29804-30156/com.vanilla.eventapp E/Surface﹕ dequeueBuffer failed (No such device)
01-22 12:57:14.637  29804-30156/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Android_NativeWindow_display_l: ANativeWindow_lock: failed -19
01-22 12:57:14.675  29804-30156/com.vanilla.eventapp E/Surface﹕ dequeueBuffer failed (No such device)
01-22 12:57:14.675  29804-30156/com.vanilla.eventapp E/IJKMEDIA﹕ SDL_Android_NativeWindow_display_l: ANativeWindow_lock: failed -19

It keeps spewing out this error even though I have closed the video player activity.

bbcallen commented 9 years ago

No idea for this situation. The point is try to obtain a fresh surface. Maybe you could try remove the whole surfaceView, detach it from the view hierarchy, and create a new SurfaceView.

thuantran commented 9 years ago

I tried that, it does work but it messes up my layout because I use SystemUiHider to hide status and navigation buttons and that glitches out if I do what you said. So in the end I couldn't use it after all.

The point is when I destroy and create default MediaPlayer it works ok. It only happens when I switch between default MediaPlayer and IjkMediaPlayer (or vitamio MediaPlayer for that matter), or if I switch between IjkMediaPlayer with and without MediaCodec enabled. You can check the new log using IjkMediaPlayer with MediaCodec enabled below:

01-22 14:18:35.075    5309-5677/com.vanilla.eventapp I/tv.danmaku.ijk.media.player.IjkMediaPlayer﹕ selected codec: OMX.qcom.video.decoder.avc rank=800
01-22 14:18:35.075    5309-5677/com.vanilla.eventapp W/IJKMEDIA﹕ SDL_AMediaCodecJava_createByCodecName
01-22 14:18:35.081    5309-5696/com.vanilla.eventapp I/OMXClient﹕ Using client-side OMX mux.
01-22 14:18:35.243    5309-5677/com.vanilla.eventapp W/IJKMEDIA﹕ SDL_AMediaCodecJava_init
01-22 14:18:35.243    5309-5677/com.vanilla.eventapp W/IJKMEDIA﹕ SDL_AMediaCodecJava_configure_surface
01-22 14:18:35.243    5309-5677/com.vanilla.eventapp E/IJKMEDIA﹕ configure 0x1004ce 0x300426
01-22 14:18:35.244    5309-5695/com.vanilla.eventapp E/MediaCodec﹕ native_window_api_connect returned an error: Invalid argument (-22)
01-22 14:18:35.244    5309-5677/com.vanilla.eventapp E/MediaCodec﹕ configure failed with err 0xffffffea, resetting...

It's likely the same problem considering the -22 error.

So it all comes back to how to reset the surface view or how to remove and add the surface view into my layout without glitching out. I'll keep trying things. If you have anything new about this, please do tell too.

thuantran commented 9 years ago

Finally managed to fix it. Instead of mediaPlayer.setDisplay(null) or other mentioned tricks here. I do this:

            ViewGroup parent = (ViewGroup) mSurfaceView.getParent();
            int index = parent.indexOfChild(mSurfaceView);
            parent.removeView(mSurfaceView);
            parent.addView(mSurfaceView, index);

in place of creating an entirely new SurfaceView object. That would cause glitch in your UI especially when you use SystemUiHider. The call to parent.removeView(mSurfaceView) here will call surfaceDestroyed where I release the old MediaPlayer object and addView will recreate the SurfaceView calling surfaceCreated where I create a new MediaPlayer object accordingly.

If you have nothing more to add we can consider this issue closed. Thanks for the awesome library.