在播放m3u8文件期间,对OMX_GetExtensionIndex的ACodec调用失败

时间:2014-06-11 16:06:47

标签: android android-mediaplayer m3u8

这有点是问题的后续行动:

m3u8 file not playing in Android Emulator

我遇到的问题与那里提出的问题非常相似,但有一个真实的设备,JB已被移植到(项目详情:http://groups.google.com/group/renesas-emev-osp/topics):

V/MediaPlayerJNI( 1064): setDataSource: path http://rai-i.akamaihd.net/i/20140610/tg1notte-100620141.00.00_REPLAY_,400,600,800,.mp4.csmil/master.m3u8
V/MediaPlayer( 1064): setDataSource(http://rai-i.akamaihd.net/i/20140610/tg1notte-100620141.00.00_REPLAY_,400,600,800,.mp4.csmil/master.m3u8)
V/MediaPlayer( 1064): setVideoSurfaceTexture
V/MediaPlayerJNI( 1064): setAudioStreamType: 3
...
D/MediaPlayer( 1064): getMetadata
E/MediaPlayerService(   74): getMetadata failed -38
V/MediaPlayerJNI( 1064): start
V/MediaPlayer( 1064): start
...
V/MediaPlayer( 1064): start
I/avc_utils(   74): found AVC codec config (700 x 394, Main-profile level 3.1)
V/ACodec  (   74): Now uninitialized
V/ACodec  (   74): onAllocateComponent
I/ESQueue (   74): found AAC codec config (44100 Hz, 2 channels)
I/EV2OMXPlugin(   74): ***run OMFPlugin ------- makeComponentInstance !!!!!!!!
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] Now Loaded
V/ACodec  (   74): onConfigureComponent - msg: AMessage(what = 'setu', target = 14) = {
V/ACodec  (   74):    string mime = "video/avc"
V/ACodec  (   74):    int32_t width = 700
V/ACodec  (   74):    int32_t height = 394
V/ACodec  (   74):    ABuffer *csd-0 = 0x2a06af40
V/ACodec  (   74):    ABuffer *csd-1 = 0x2a0722b0
V/ACodec  (   74):    RefBase *native-window = 0x2a026e88
V/ACodec  (   74):  }
V/ACodec  (   74): initNativeWindow
E/OMXNodeInstance(   74): OMX_GetExtensionIndex (index:'7fffffff') failed
F/ACodec  (   74): frameworks/av/media/libstagefright/ACodec.cpp:3107 CHECK_EQ( (status_t)OK,mCodec->initNativeWindow()) failed: 0 vs. -2147483648
F/libc    (   74): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 1490 (NuPlayerDecoder)
...

对于上面的仿真器案例,OMX_GetExtensionIndex调用失败,因为供应商OMX实现不包含与NativeBuffer相关的函数:

https://github.com/Renesas-EMEV2/Renesas-device_emev/blob/emev-4.1/omf/OMF_Extension.h

在OMXCodec中(由AwesomePlayer用来成功播放mp4文件)根本不调用initNativeWindow()(根据我捕获的调试日志)。

此外,我们的JB移植包括在OMXCodec创建中对componentName的额外检查:

OMXCodec::OMXCodec(
    const sp<IOMX> &omx, IOMX::node_id node,
    uint32_t quirks, uint32_t flags,
    bool isEncoder,
    const char *mime,
    const char *componentName,
    const sp<MediaSource> &source,
    const sp<ANativeWindow> &nativeWindow)
: mOMX(omx),
...
    mNativeWindow(
        (!strncmp(componentName, "OMX.google.", 11)
        || !strncmp(componentName, "OMX.RENESAS.", 12)
        || !strcmp(componentName, "OMX.Nvidia.mpeg2v.decode"))
                ? NULL : nativeWindow) {
...

所以,看起来mNativeWindow在我们的例子中是无效的(OMX.RENESAS。),这会使一堆逻辑被跳过,当然包括initNativeWindow。

在ACodec :: onConfgureComponent中添加相同的检查,而不是调用InitNativeWindow逻辑:

if (msg->findObject("native-window", &obj)
        && strncmp("OMX.google.", mCodec->mComponentName.c_str(), 11)
    && strncmp("OMX.RENESAS.", mCodec->mComponentName.c_str(), 12)) {
        ...
    CHECK_EQ((status_t)OK, mCodec->initNativeWindow());
}

NuPlayer在m3u8播放时不再崩溃,但在m3u8播放时屏幕仍为黑色,而音频继续播放!

比较OMXCodec(mp4 - OK)与ACodec(m3u8 - black outout)的日志,我可以看到类似的调用重复:

V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocating 2 buffers of size 1048576 on input port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a04b020 on input port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a065ca8 on input port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocating 5 buffers of size 3133440 on output port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a065dd0 on output port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a061de0 on output port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a061ec0 on output port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a061fc0 on output port
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] allocated buffer 0x2a0620a0 on output port
...
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] EMPTY_BUFFER_DONE(buffer: 0x2a04b020)
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] Calling emptyBuffer on buffer 0x2a04b020 (length 18339), timestamp 40000 us (0.04 
...
V/OMXCodec(   74): [OMX.RENESAS.VIDEO.DECODER.H264] FILL_BUFFER_DONE(buffer: 0x2a065dd0, size: 449280, flags: 0x00000010, timestamp: 40000 us (0.04 secs))
...

V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] Now Loaded->Idle
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] Allocating 2 buffers of size 1048576 on input port
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] Allocating 5 buffers of size 3133440 on output port
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] Now Idle->Executing
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling fillBuffer 0x2a068970
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling fillBuffer 0x2a056fd0
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling fillBuffer 0x2a0570e8
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling fillBuffer 0x2a057228
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling fillBuffer 0x2a0572f8
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] Now Executing
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling emptyBuffer 0x2a054898 w/ codec specific data
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] onOMXEmptyBufferDone 0x2a054898
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling emptyBuffer 0x2a03cb88 w/ codec specific data
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling emptyBuffer 0x2a054898 w/ time 0 us
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] onOMXEmptyBufferDone 0x2a03cb88
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] onOMXEmptyBufferDone 0x2a054898
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling emptyBuffer 0x2a03cb88 w/ time 40000 us
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] onOMXEmptyBufferDone 0x2a03cb88
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling emptyBuffer 0x2a054898 w/ time 80000 us
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] calling emptyBuffer 0x2a03cb88 w/ time 120000 us
V/ACodec  (   74): [OMX.RENESAS.VIDEO.DECODER.H264] onOMXFillBufferDone 0x2a068970 time 0 us, flags = 0x00000010

...

但看起来还有其他东西仍然缺失......

有什么建议吗?

0 个答案:

没有答案