bilibili / ijkplayer

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

网络不好长时间请求数据造成的闪退问题 #2455

Open yeshibuzhong opened 7 years ago

yeshibuzhong commented 7 years ago

崩溃在这个函数里边的断言, int SDL_LockMutex(SDL_mutex *mutex) { assert(mutex); if (!mutex) return -1;

return pthread_mutex_lock(&mutex->id);

}

线上app有些用户闪退在这里,也是断言位置, ios8-10.2都会出现这个问题, 5s包括5s以前的机型概率最高, 6以后的机型概率较低 int SDL_UnlockMutex(SDL_mutex *mutex) { assert(mutex); if (!mutex) return -1;

return pthread_mutex_unlock(&mutex->id);

}

手机型号:6s plus 以下是log, 请大神帮忙分析一下原因

===== versions =====
[FFPlayer @ 0x14591c330] FFmpeg       : ff3.1--ijk0.6.0--20160715--001
[FFPlayer @ 0x14591c330] libavutil    : 55.27.100
[FFPlayer @ 0x14591c330] libavcodec   : 57.48.101
[FFPlayer @ 0x14591c330] libavformat  : 57.40.101
[FFPlayer @ 0x14591c330] libswscale   : 4.1.100
[FFPlayer @ 0x14591c330] libswresample: 2.1.100
===== options =====
[FFPlayer @ 0x14591c330] player-opts : start-on-prepared            = 1
[FFPlayer @ 0x14591c330] player-opts : overlay-format               = fcc-_es2
[FFPlayer @ 0x14591c330] player-opts : max-fps                      = 30
[FFPlayer @ 0x14591c330] player-opts : framedrop                    = 0
[FFPlayer @ 0x14591c330] player-opts : videotoolbox-max-frame-width = 3840
[FFPlayer @ 0x14591c330] player-opts : videotoolbox                 = 1
[FFPlayer @ 0x14591c330] player-opts : video-pictq-size             = 3
[FFPlayer @ 0x14591c330] format-opts : ijkinject-opaque             = 5462166784
[FFPlayer @ 0x14591c330] format-opts : ijkapplication               = 5462139376
[FFPlayer @ 0x14591c330] format-opts : user-agent                   = ijkplayer
[FFPlayer @ 0x14591c330] format-opts : auto_convert                 = 0
[FFPlayer @ 0x14591c330] format-opts : timeout                      = 30000000
[FFPlayer @ 0x14591c330] format-opts : reconnect                    = 1
[FFPlayer @ 0x14591c330] format-opts : safe                         = 0
[FFPlayer @ 0x14591c330] codec-opts  : skip_loop_filter             = 0
[FFPlayer @ 0x14591c330] codec-opts  : skip_frame                   = 0
===================
ijkmp_prepare_async()=0
ijkmp_start()
ijkmp_start()=-3
[http @ 0x145902190] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[BBNetWorkManager.m:246行] urlSTring 删除成功
[http @ 0x145902190] request: GET /11459.m3u8?timestamp=1482135411&sign=4d97dbe247d6fb78c42313bc870458fe HTTP/1.1

User-Agent: ijkplayer

Accept: */*

Range: bytes=0-

Connection: close

Host: static.video360.vrbig.com

Icy-MetaData: 1

[http @ 0x145902190] request: GET /static.video360.vrbig.com/11459.m3u8?timestamp=1482135411&sign=4d97dbe247d6fb78c42313bc870458fe HTTP/1.1

User-Agent: ijkplayer

Accept: */*

Range: bytes=0-

Connection: close

Host: 183.131.55.15

Icy-MetaData: 1

[hls,applehttp @ 0x1449a3400] Format hls,applehttp probed with size=2048 and score=100
[hls,applehttp @ 0x1449a3400] HLS request for url 'http://183.131.55.15/static.video360.vrbig.com/927fa21b447b4ae2ab8e1545861f17e5_00000.ts?timestamp=1482135411&m3u8=LzExNDU5Lm0zdTg%3D&sign=4d97dbe247d6fb78c42313bc870458fe', offset 0, playlist 0
[http @ 0x143d824b0] request: GET /static.video360.vrbig.com/927fa21b447b4ae2ab8e1545861f17e5_00000.ts?timestamp=1482135411&m3u8=LzExNDU5Lm0zdTg%3D&sign=4d97dbe247d6fb78c42313bc870458fe HTTP/1.1

User-Agent: ijkplayer

Accept: */*

Connection: close

Host: 183.131.55.15

Icy-MetaData: 1

Format mpegts probed with size=2048 and score=50
[mpegts @ 0x14414ec00] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 0x14414ec00] stream=1 stream_type=f pid=101 prog_reg_desc=
[mpegts @ 0x14414ec00] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[h264 @ 0x144263c00] user data:"x264 - core 144 r2525+52 a9a0b2b xiaowan [8-bit@all X86] - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=4 deblock=1:1:1 analyse=0x3:0x133 me=umh subme=10 psy=1 fade_compensate=0.00 psy_rd=0.00:0.00 mixed_ref=1 me_range=32 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 fgo=0 bframes=4 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=75 keyint_min=1 scenecut=60 intra_refresh=0 rc_lookahead=60 rc=abr mbtree=1 bitrate=2200 ratetol=1.0 qcomp=0.60 qpmin=0:0:0 qpmax=69:69:69 qpstep=4 vbv_maxrate=5000 vbv_bufsize=1800 nal_hrd=none filler=0 ip_ratio=1.40 aq=3:0.50 aq-sensitivity=10.00 aq-factor=1.00:1.00:1.00 aq2=0 aq3=0"
[h264 @ 0x144263c00] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x144263c00] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x144263c00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x144263c00] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x144263c00] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x144263c00] user data:"x264 - core 144 r2525+52 a9a0b2b xiaowan [8-bit@all X86] - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=4 deblock=1:1:1 analyse=0x3:0x133 me=umh subme=10 psy=1 fade_compensate=0.00 psy_rd=0.00:0.00 mixed_ref=1 me_range=32 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 fgo=0 bframes=4 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=75 keyint_min=1 scenecut=60 intra_refresh=0 rc_lookahead=60 rc=abr mbtree=1 bitrate=2200 ratetol=1.0 qcomp=0.60 qpmin=0:0:0 qpmax=69:69:69 qpstep=4 vbv_maxrate=5000 vbv_bufsize=1800 nal_hrd=none filler=0 ip_ratio=1.40 aq=3:0.50 aq-sensitivity=10.00 aq-factor=1.00:1.00:1.00 aq2=0 aq3=0"
[h264 @ 0x144263c00] no picture 
[BBIJKPlayerVC.m:837行] Id = 11459 type = 6 pptvmovieid = 0a2dnq6ap6alnaqL4K2doKbhoaelna6Wpw
[BBIJKPlayerVC.m:845行] 1
[BBNetWorkManager.m:148行] url = http://t.api.vrbig.com/system/getPlayUrlByType?pptvmovieid=0a2dnq6ap6alnaqL4K2doKbhoaelna6Wpw&r=1080&id=11459&type=1&isTV=0&t=1482135425&s=0f9277dd14c1a3716ce962a41fbba3de&v=5.3.0&k=0f9277dd14c1a3716ce962a41fbba3de&os=appstore&userid=21014465&sessid=6mmdbbujkftaapmaloo5c42q85
ijkmp_stop()
ijkmp_stop()=0
ijkmp_shutdown_l()
wait for read_tid
[AVIOContext @ 0x14590a360] Statistics: 286200 bytes read, 0 seeks
[hls,applehttp @ 0x1449a3400] HLS request for url 'http://183.131.55.15/static.video360.vrbig.com/927fa21b447b4ae2ab8e1545861f17e5_00001.ts?timestamp=1482135411&m3u8=LzExNDU5Lm0zdTg%3D&sign=4d97dbe247d6fb78c42313bc870458fe', offset 0, playlist 0
[mpegts @ 0x14414ec00] All info found
[mpegts @ 0x14414ec00] Setting avg frame rate based on r frame rate
[mpegts @ 0x14414ec00] After avformat_find_stream_info() pos: 286200 bytes read:286200 seeks:0 frames:117
Option safe not found.
[hls,applehttp @ 0x1449a3400] Before avformat_find_stream_info() pos: 3555 bytes read:3555 seeks:0 nb_streams:2
[hls,applehttp @ 0x1449a3400] interrupted
[hls,applehttp @ 0x1449a3400] After avformat_find_stream_info() pos: 3555 bytes read:3555 seeks:0 frames:0
[FFPlayer @ 0x14591c330] max_frame_duration: 10.000
Input #0, hls,applehttp, from 'http://static.video360.vrbig.com/11459.m3u8?timestamp=1482135411&sign=4d97dbe247d6fb78c42313bc870458fe':
  Duration: 00:04:01.08, bitrate: 0 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0, 0, 1/90000: Video: h264, 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(tv, bt709/unknown/unknown, left), 2048x1024 (0x0) [SAR 1:1 DAR 2:1], 0/1, 90k tbr, 90k tbn, 90k tbc
    Stream #0:1, 0, 1/90000: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 6 kb/s
aout_open_audio()
[FFPlayer @ 0x14591c330] AudioCodec: avcodec, aac
aout_pause_audio(0)
[h264 @ 0x1449d4c00] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x1449d4c00] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x1449d4c00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x1449d4c00] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x1449d4c00] Ignoring NAL type 9 in extradata
[h264 @ 0x1449d4c00] Ignoring NAL type 6 in extradata
m_max_ref_frames 4 
m_max_ref_frames 4 
after scale width 2048 height 1024 
[BBNetWorkManager.m:246行] urlSTring 删除成功
[FFPlayer @ 0x14591c330] fps: 90000.000000 (normal)
aout_close_audio()
[AVIOContext @ 0x143d9e440] Statistics: 3555 bytes read, 0 seeks
wait for video_refresh_tid
ijkmp_shutdown_l()=void
ijkmp_dec_ref(): ref=0
ijkmp_shutdown_l()
ijkmp_shutdown_l()=void
aout_close_audio()
[BBIJKPlayerVC.m:853行] jsonstr = http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.m3u8?type=m3u8.web.cloudplay&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170&ppyunid=158576944
[BBIJKPlayerVC.m:899行] http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.m3u8?type=m3u8.web.cloudplay&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170&ppyunid=158576944
av_version_info: ff3.1--ijk0.6.0--20160715--001
ijkmp_set_inject_opaque(0x145928c60)
ijkmp_set_inject_opaque()=void
[IJKSDLGLView.m:319行] OK setup GL

[IJKSDLGLView.m:1920行] init sphere 12288 18432
[IJKSDLGLView.m:1797行] init sphere 12288 18432
ijkmp_ios_set_view(glView=0x14414ec00)
ijkmp_ios_set_view(glView=0x14414ec00)=void
ijkmp_set_data_source(url="http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.m3u8?type=m3u8.web.cloudplay&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170&ppyunid=158576944")
ijkmp_set_data_source(url="http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.m3u8?type=m3u8.web.cloudplay&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170&ppyunid=158576944")=0
ijkmp_prepare_async()
===== versions =====
[FFPlayer @ 0x14591c330] FFmpeg       : ff3.1--ijk0.6.0--20160715--001
[FFPlayer @ 0x14591c330] libavutil    : 55.27.100
[FFPlayer @ 0x14591c330] libavcodec   : 57.48.101
[FFPlayer @ 0x14591c330] libavformat  : 57.40.101
[FFPlayer @ 0x14591c330] libswscale   : 4.1.100
[FFPlayer @ 0x14591c330] libswresample: 2.1.100
===== options =====
[FFPlayer @ 0x14591c330] player-opts : start-on-prepared            = 1
[FFPlayer @ 0x14591c330] player-opts : overlay-format               = fcc-_es2
[FFPlayer @ 0x14591c330] player-opts : max-fps                      = 30
[FFPlayer @ 0x14591c330] player-opts : framedrop                    = 0
[FFPlayer @ 0x14591c330] player-opts : videotoolbox-max-frame-width = 3840
[FFPlayer @ 0x14591c330] player-opts : videotoolbox                 = 1
[FFPlayer @ 0x14591c330] player-opts : video-pictq-size             = 3
[FFPlayer @ 0x14591c330] format-opts : ijkinject-opaque             = 5462199392
[FFPlayer @ 0x14591c330] format-opts : ijkapplication               = 5462139376
[FFPlayer @ 0x14591c330] format-opts : user-agent                   = ijkplayer
[FFPlayer @ 0x14591c330] format-opts : auto_convert                 = 0
[FFPlayer @ 0x14591c330] format-opts : timeout                      = 30000000
[FFPlayer @ 0x14591c330] format-opts : reconnect                    = 1
[FFPlayer @ 0x14591c330] format-opts : safe                         = 0
[FFPlayer @ 0x14591c330] codec-opts  : skip_loop_filter             = 0
[FFPlayer @ 0x14591c330] codec-opts  : skip_frame                   = 0
===================
ijkmp_prepare_async()=0
ijkmp_start()
ijkmp_start()=-3
[http @ 0x143dd3eb0] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[http @ 0x143dd3eb0] request: GET /fb44fa7465f1be875b4247fc9eed70e0.m3u8?type=m3u8.web.cloudplay&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170&ppyunid=158576944 HTTP/1.1

User-Agent: ijkplayer

Accept: */*

Range: bytes=0-

Connection: close

Host: 112.117.210.47

Icy-MetaData: 1

[hls,applehttp @ 0x1449a3400] Format hls,applehttp probed with size=2048 and score=100
[hls,applehttp @ 0x1449a3400] HLS request for url 'http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.ts?start=0&during=20&type=m3u8.web.cloudplay&ppyunid=158576944&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170', offset 0, playlist 0
[http @ 0x145a084d0] request: GET /fb44fa7465f1be875b4247fc9eed70e0.ts?start=0&during=20&type=m3u8.web.cloudplay&ppyunid=158576944&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170 HTTP/1.1

User-Agent: ijkplayer

Accept: */*

Connection: close

Host: 112.117.210.47

Icy-MetaData: 1

Format mpegts probed with size=2048 and score=50
[mpegts @ 0x144968800] stream=0 stream_type=f pid=101 prog_reg_desc=
[mpegts @ 0x144968800] stream=1 stream_type=1b pid=102 prog_reg_desc=
[mpegts @ 0x144968800] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[BBIJKPlayerVC.m:837行] Id = 11459 type = 6 pptvmovieid = 0a2dnq6ap6alnaqL4K2doKbhoaelna6Wpw
[BBIJKPlayerVC.m:845行] 2
[BBNetWorkManager.m:148行] url = http://t.api.vrbig.com/system/getPlayUrlByType?pptvmovieid=0a2dnq6ap6alnaqL4K2doKbhoaelna6Wpw&r=1080&id=11459&type=5&isTV=0&t=1482135440&s=4607b0d4631efdb59dcecfc1cd417dba&v=5.3.0&k=4607b0d4631efdb59dcecfc1cd417dba&os=appstore&userid=21014465&sessid=6mmdbbujkftaapmaloo5c42q85
ijkmp_stop()
ijkmp_stop()=0
ijkmp_shutdown_l()
wait for read_tid
[AVIOContext @ 0x143d9e440] Statistics: 51326 bytes read, 0 seeks
[hls,applehttp @ 0x1449a3400] HLS request for url 'http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.ts?start=20&during=10&type=m3u8.web.cloudplay&ppyunid=158576944&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170', offset 0, playlist 0
[h264 @ 0x144151000] user data:"x264()-core 129 - H.264/MPEG-4 - Copyleft 2003-2012 - options: cabac=1 ref=4 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=0.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=40 lookahead_threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=4 b_pyramid=2 b_adapt=0 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=2pass mbtree=1 bitrate=5000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 vbv_maxrate=10000 vbv_bufsize=5000 nal_hrd=none ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x144151000] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x144151000] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x144151000] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x144151000] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 0x144151000] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x144151000] user data:"x264()-core 129 - H.264/MPEG-4 - Copyleft 2003-2012 - options: cabac=1 ref=4 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=0.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=40 lookahead_threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=4 b_pyramid=2 b_adapt=0 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=2pass mbtree=1 bitrate=5000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 vbv_maxrate=10000 vbv_bufsize=5000 nal_hrd=none ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x144151000] no picture 
[h264 @ 0x144151000] bytestream overread -19
[h264 @ 0x144151000] error while decoding MB 36 30, bytestream -19
[h264 @ 0x144151000] concealing 3613 DC, 3613 AC, 3613 MV errors in I frame
[mpegts @ 0x144968800] After avformat_find_stream_info() pos: 51326 bytes read:51326 seeks:0 frames:2
Option safe not found.
[hls,applehttp @ 0x1449a3400] Before avformat_find_stream_info() pos: 3971 bytes read:3971 seeks:0 nb_streams:2
[hls,applehttp @ 0x1449a3400] interrupted
[hls,applehttp @ 0x1449a3400] After avformat_find_stream_info() pos: 3971 bytes read:3971 seeks:0 frames:0
[FFPlayer @ 0x14591c330] max_frame_duration: 10.000
Input #0, hls,applehttp, from 'http://112.117.210.47/fb44fa7465f1be875b4247fc9eed70e0.m3u8?type=m3u8.web.cloudplay&k=98fed20d87ee81d7131e7b87df30fa3f-df26-1482149826&cpn=170&ppyunid=158576944':
  Duration: 00:04:01.00, bitrate: N/A
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0, 0, 1/90000: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 63 kb/s
    Stream #0:1, 0, 1/90000: Video: h264, 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(left), 1920x960 (0x0) [SAR 1:1 DAR 2:1], 0/1, 90k tbr, 90k tbn, 90k tbc
aout_open_audio()
[FFPlayer @ 0x14591c330] AudioCodec: avcodec, aac
aout_pause_audio(0)
vtbformat_init - avcC atom too data small or missingAssertion failed: (mutex), function SDL_LockMutex, file /Users/wangyahui/Desktop/BoBoPlayer5.0/BoBoPlayer4.0/IJKMediaPlayer/IJKFFMoviePlayerController/ijkmedia/ijksdl/ijksdl_mutex.c, line 63.
xinzhengzhang commented 7 years ago

Update to latest version

yeshibuzhong commented 7 years ago

thank you, my problem is solved

DysaniazzZ commented 5 years ago

@yeshibuzhong hi dude, how to solve the problem? any idea? use the latest version?