Ijkplayer: 使用「ijkio:cache:ffio:」 缓存音频的话64位会报错

Created on 12 Jun 2019  ·  12Comments  ·  Source: bilibili/ijkplayer

有人知道解决办法吗?如果使用32位的library就没有问题

libijkffmpeg.so (av_opt_next+24)

Most helpful comment

我也遇到了相同的问题,不过我已经解决了,在libavutil/opt.c文件的av_opt_set_defaults2函数中加入
if (opt->offset == 0) continue;
你也可以直接使用我编译好的
https://github.com/WaterlooBridge/Player/blob/master/src/main/jniLibs/arm64-v8a/libijkffmpeg.so

All 12 comments

please provide more log or crash stack

这是Log日志,看看能不能得到一些结论。
`

g A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7500000010 in tid 10637 (ff_read),

: ABI: 'arm64'
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: pid: 10389, tid: 10637, name: ff_read >>> com.audio.xxxxxx<<<
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7500000010
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x0 0000007500000000 x1 0000000000000000 x2 00000075e61aa940 x3 0000000000000000
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x4 0000000000000000 x5 00000075d720b170 x6 0000000000000000 x7 00000075e155b8f0
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x8 00000075e61aa930 x9 0000000000000000 x10 0000000000000049 x11 00000000ffffff9f
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x12 0000000000000007 x13 0000000000000000 x14 00000000ffffffff x15 0000000000000000
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x16 0000007680e70bc8 x17 0000007680e06250 x18 0000007680e7c000 x19 0000000000000000
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x20 00000075e61aa940 x21 0000000000000000 x22 0000000000000000 x23 0000000000000000
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x24 00000075e61aa930 x25 00000075d720b170 x26 0000007500000000 x27 00000075c92099d0
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: x28 0000000000000001 x29 00000075d720b2d0
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: sp 00000075d720b0c0 lr 00000075b435cec4 pc 00000075b435c7fc
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: backtrace:
2019-06-13 10:30:27.070 10640-10640/? A/DEBUG: #00 pc 00000000002d67fc /data/app/com.audio.xxxxx-JK-DIVYbow9Q3mRrxguEig==/lib/arm64/libijkffmpeg.so (av_opt_next+24)
2019-06-13 10:30:27.110 2546-2555/? E/hypnusd: submit updown migration(Unknown error 524)
`

only one symbol av_opt_next in the backtrace ?

是的,而且是必现的问题。你有什么思路之类的吗

I have not used ijkio:cache:ffio in the past time.
@lrannn
if you can provide the way to reproduce this crash, I will try it when I have free time

I have not used ijkio:cache:ffio in the past time.
@lrannn
if you can provide the way to reproduce this crash, I will try it when I have free time

不好意思我刚看到回复。测试代码如下:

        mediaPlayer = new IjkMediaPlayer();
        mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        mediaPlayer.setDataSource("ijkio:cache:ffio:real_audio_play_uri");
        setupIjkPlayerOptions(mediaPlayer);
        mediaPlayer.setOnPreparedListener(this);

        mediaPlayer.prepareAsync();

    //设置Cache相关的参数
    private void setupIjkPlayerOptions(IjkMediaPlayer mIjkPlayer) {
        String basicPath = Environment.getExternalStorageDirectory().getPath() + "/tt/tmp/";
        mIjkPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "cache_file_path", basicPath + "audio.tmp");
        mIjkPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "cache_map_path", basicPath + "2.tmp");
        mIjkPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "parse_cache_map", 1);
        mIjkPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "auto_save_map", 1);
    }

这段代码在armv7下是正常的,功能也可以使用,如果使用arm64-v8a的包,则会crash。目前我的解决办法为只使用armv7的so库。

Hi @lrannn , sorry for the late.
I add native c code debug ability for ijkplayer, you can get the update from https://github.com/befovy/ijkplayer.

I tried the step you said, but no crash.

By using https://github.com/befovy/ijkplayer for native bug, you can see which line lead to the crash if it crashed in the ijkplayer's c source code.
Hope the solution from you.
BTW, I use ndk version r15c.

我也遇到了相同的问题,不过我已经解决了,在libavutil/opt.c文件的av_opt_set_defaults2函数中加入
if (opt->offset == 0) continue;
你也可以直接使用我编译好的
https://github.com/WaterlooBridge/Player/blob/master/src/main/jniLibs/arm64-v8a/libijkffmpeg.so

@WaterlooBridge thank you; I have the same crash; and useful for me;

问题已解,由衷感谢各位大佬的鼎力帮助!谢谢各位!

收藏,,我去修改试试,,感谢。。

按照上面修改后,,异常信息变了,,还应该修改哪里呢?

09-25 11:28:55.332 26820 26820 I IJKMEDIA: ===================
09-25 11:28:55.333 26820 27298 I IJKMEDIA: SDL_RunThread: [27298] ff_vout
09-25 11:28:55.333 26820 27299 I IJKMEDIA: SDL_RunThread: [27299] ff_read
09-25 11:28:55.402 2979 4519 I [Gralloc]: alloc w[1218] h[735] format[1] usage[2816]
09-25 11:28:55.404 2979 4519 I [Gralloc]: alloc succ handle[0x55849d5c10] stride[1248]
09-25 11:28:55.404 2979 4519 I [Gralloc]: alloc w[1218] h[735] format[1] usage[2816]
09-25 11:28:55.407 2979 4519 I [Gralloc]: alloc succ handle[0x55848a8bf0] stride[1248]
09-25 11:28:55.407 2979 4519 I [Gralloc]: alloc w[1218] h[735] format[1] usage[2816]
09-25 11:28:55.409 2979 4519 I [Gralloc]: alloc succ handle[0x55848a6130] stride[1248]
09-25 11:28:55.415 26820 27299 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
09-25 11:28:55.415 26820 27299 W google-breakpad: Chrome build fingerprint:
09-25 11:28:55.415 26820 27299 W google-breakpad: 1.0
09-25 11:28:55.415 26820 27299 W google-breakpad: 1
09-25 11:28:55.415 26820 27299 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
09-25 11:28:55.878 2990 2990 E DEBUG : AM write failed: Broken pipe
09-25 11:28:55.905 2979 3037 I [Gralloc]: alloc w[360] h[642] format[1] usage[819]
09-25 11:28:55.907 2979 3037 I [Gralloc]: alloc succ handle[0x5584983fc0] stride[416]

Was this page helpful?
0 / 5 - 0 ratings