Ijkplayer: iOS9.x 切换后台, 进入前台, 画面暂停,有声音,日志recovery error!!!!

Created on 25 Jan 2016  ·  13Comments  ·  Source: bilibili/ijkplayer

环境:m3u8 的源地址 http://v.baoliao.topv.yunfan.com/video/t01b5f5063e8284f474.m3u8
今天测试了一下 7.1.2 7.2 的手机没有此问题,
9.x 的手机,必现 日志log
after scale width 480 height 480
recovery error!!!!

跟踪了一下 应该是 IJKVideoToolBox.m -> CreateVTBSession -> videotoolbox_decode_video
请问下什么情况这种 recovery error!!!! 会出现,难道9.x 系统改变的策略,
这个与服务器的配置有关系吗。
谢谢

bug

Most helpful comment

我是在 IJKVideoToolBox.m static int decode_video(VideoToolBoxContext* context, AVCodecContext _avctx, AVPacket *avpkt, int_ got_picture_ptr)

添加了这一句
context->idr_based_identified = false

就没问题了

All 13 comments

9.2 模拟器没有此问题,在真机上必现

跟踪播放时 画面卡住
decode callback -12909 kVTVideoDecoderBadDataErr
decodeFrame -12911 kVTVideoDecoderMalfunctionErr

I'll take a look. But I don't think it could be fixed soon.

ok thanks

请问楼主问题解决了吗 我也碰到了同样的问题

解决问题了么 我也遇到了这个问题 模拟器上seek没问题 真机上seek不到画面 声音有

我是在 IJKVideoToolBox.m static int decode_video(VideoToolBoxContext* context, AVCodecContext _avctx, AVPacket *avpkt, int_ got_picture_ptr)

添加了这一句
context->idr_based_identified = false

就没问题了

lt's work for me, 楼上正解 在decode_video函数里面 加一句context->idr_based_identified = false 就可以继续播放了

it‘s done!!!
我之前跟踪的使用修改了这里 注释掉其中的一个判断 if ((context->m_buffer_deep > 0) /* &&
ff_avpacket_i_or_idr(&context->m_buffer_packet[0], context->idr_based_identified) == true */)
具体啥原因呢?

@Singsmlie
In this case, there is a videotoolbox decode failure when the app enter foreground.
ijk will try to recovery pictures until next idr frame. But it seems that there hasn't excepted frame in this stream.

Turn off idr_based_identified is just a workaround for these weird video.
For some video may be it will bring a blurred screen.

@yeshibuzhong 能说一下这么修改的原因么

我是在 IJKVideoToolBox.m static int decode_video(VideoToolBoxContext* context, AVCodecContext _avctx, AVPacket *avpkt, int_ got_picture_ptr)

添加了这一句
context->idr_based_identified = false

就没问题了

我说一下我的解决办法:按照 @Singsmlie 说的,在IJKVideoToolBoxAsync.m和IJKVideoToolBoxSync.m中,分别注掉decode_video函数中的if ((context->m_buffer_deep > 0) /*&& ff_avpacket_i_or_idr(&context->m_buffer_packet[0], context->idr_based_identified) == true */)判断语句中的*&& ff_avpacket_i_or_idr(&context->m_buffer_packet[0], context->idr_based_identified) == true */条件,两个文件中都要注释,不然可能会出现crash问题。

idr_based_identified在初始化时直接赋值为true,但是m3u8的ts里可能没有idr,所以我在DuplicatePkt修正了一下idr_based_identified:
在DuplicatePkt里加上
if (context->m_buffer_deep == 0) {
context->idr_based_identified = ff_avpacket_is_idr(pkt);
}

Was this page helpful?
0 / 5 - 0 ratings