这在某种程度上是问题的后续:
我有一个与那边问的问题非常相似的问题,但使用的是 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::onConfigureComponent 中添加同样的检查,而不是调用 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
...
但看起来仍然缺少其他东西......
有什么建议吗?