ACodec call to OMX_GetExtensionIndex fails, during playback of an m3u8 file

╄→гoц情女王★ 提交于 2019-12-04 05:29:31

问题


This is somewhat a follow-up to question:

m3u8 file not playing in Android Emulator

I have a very similar issue to the one asked over there, but with a real device where JB has been ported to (project details at: 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)
...

As for the emulator case above, the OMX_GetExtensionIndex call fails, as the vendor OMX implementation doesn't include the NativeBuffer-related functions:

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

In the OMXCodec (used by the AwesomePlayer to succesfully play mp4 files) initNativeWindow() isn't invoked at all (as per debug logs I've captured).

Also, our JB porting included this additional check for componentName, in the OMXCodec creation:

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) {
...

So, looks like mNativeWindow is nullified in our case (OMX.RENESAS.) and that makes a bunch of logic being skipped, including initNativeWindow of course.

Adding this same check, not to call the InitNativeWindow logic, in ACodec::onConfgureComponent:

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 isn't crashing anymore on the m3u8 playback, but screen remains black on m3u8 playback, while audio goes on!

Comparing logs from the OMXCodec (mp4 - OK) vs ACodec (m3u8 - black outout) I can see similar calls repeating:

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

...

but looks like something else is still missing...

Any suggestion?

来源:https://stackoverflow.com/questions/24167635/acodec-call-to-omx-getextensionindex-fails-during-playback-of-an-m3u8-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!