简体   繁体   English

无法在Android模拟器中播放m3u8文件

[英]m3u8 file not playing in Android Emulator

I am trying to playback a m3u8 file in Android Emulator. 我正在尝试在Android模拟器中播放m3u8文件。 http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

It's not able to playback the video but audio is heard. 它无法播放视频,但可以听到音频。
I get the following error E/OMXNodeInstance( 39): OMX_GetExtensionIndex failed . 我收到以下错误E/OMXNodeInstance( 39): OMX_GetExtensionIndex failed

I traced the calls and I see that the video decoder is not instantiated properly, 我跟踪了呼叫,发现视频解码器未正确实例化,
I find that OMXNodeInstance::enableGraphicBuffers is getting called and that calls, 我发现OMXNodeInstance::enableGraphicBuffers正在被调用,并且该调用,
OMX_ERRORTYPE err = OMX_GetExtensionIndex(...,const_cast<OMX_STRING>("OMX.google.android.index.enableAndroidNativeBuffers"),...);
which is then calling OMX_ERRORTYPE SoftOMXComponent::getExtensionIndex , 然后调用OMX_ERRORTYPE SoftOMXComponent::getExtensionIndex
but there is no implementation for this function. 但是此功能没有实现。
It just returns UndefinedError (code below) 它只是返回UndefinedError(下面的代码)

OMX_ERRORTYPE SoftOMXComponent::getExtensionIndex(const char *name, OMX_INDEXTYPE *index)
{
return OMX_ErrorUndefined;
}

Can somebody please help me to overcome this GetExtentionIndex failure. 有人可以帮我克服GetExtentionIndex错误。 Log Below 在下面登录

/ChromiumHTTPDataSource( 39): connect to http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8 @0
V/NuPlayer( 39): scanning sources haveAudio=0, haveVideo=0
V/NuPlayer( 39): in instantiateDecoder at 693 audio = 0 
V/NuPlayer( 39): in instantiateDecoder at 693 audio = 1 
I/ESQueue ( 39): found AAC codec config (22050 Hz, 1 channels)
I/avc_utils( 39): found AVC codec config (192 x 144, Baseline-profile level 1.1)
V/MediaPlayer( 583): in getCurrentPosition at : 425
V/MediaPlayerService( 39): getCurrentPosition
V/MediaPlayerService( 39): [1] getCurrentPosition = 0
V/NuPlayer( 39): scanning sources haveAudio=0, haveVideo=0
V/NuPlayer( 39): in instantiateDecoder at 701 mime = video/avc
V/ACodec ( 39): Now uninitialized
V/ACodec ( 39): Now uninitialized
V/ACodec ( 39): onAllocateComponent
I/MediaPlayerService( 39): MediaPlayerService::getOMX()
V/SoftOMXPlugin( 39): makeComponentInstance 'OMX.google.h264.decoder'
V/SoftOMXPlugin( 39): makeComponentInstance at 106 
V/ACodec ( 39): onAllocateComponent
I/MediaPlayerService( 39): MediaPlayerService::getOMX()
V/SoftOMXPlugin( 39): makeComponentInstance at 128 
V/SoftOMXPlugin( 39): makeComponentInstance 'OMX.google.aac.decoder'
V/SoftOMXPlugin( 39): makeComponentInstance at 106 
V/SoftOMXPlugin( 39): makeComponentInstance at 128 
V/ACodec ( 39): [OMX.google.h264.decoder] Now Loaded
V/ACodec ( 39): onConfigureComponent
V/ACodec ( 39): configureCodec at 870 
V/ACodec ( 39): setupVideoDecoder at 1400 
V/ACodec ( 39): setupVideoDecoder at 1402 mime = video/avc 
V/ACodec ( 39): setupVideoDecoder at 1406 
V/ACodec ( 39): setupVideoDecoder at 1414 
V/ACodec ( 39): setupVideoDecoder at 1421 
V/ACodec ( 39): setupVideoDecoder at 1429 
V/ACodec ( 39): setupVideoDecoder at 1437 
V/ACodec ( 39): initNativeWindow at 1962 
V/ACodec ( 39): initNativeWindow at 1967 
E/OMXNodeInstance( 39): OMX_GetExtensionIndex failed
V/OMXNodeInstance( 39): enableGraphicBuffers at 301 OMX_GetExtensionIndex returned 2147487745
V/ACodec ( 39): onStart
V/ACodec ( 39): [OMX.google.h264.decoder] Now Loaded->Idle

Try to run it in real device, as I know emulators with some specific sdk's(like 3.1) crash playing m3u8 file. 尝试在实际设备中运行它,因为我知道模拟器在播放m3u8文件时会崩溃,并带有某些特定的sdk(例如3.1)。 And if didn't resolve the issue maybe you can use some 3rd paty plugins like Vitamio http://vitamio.org/ 如果仍不能解决问题,则可以使用一些第三种插件,例如Vitamio http://vitamio.org/

This is a very interesting question. 这是一个非常有趣的问题。 From your logs, I would like to quote this portion 从您的日志中,我想引用此部分

E/OMXNodeInstance( 39): OMX_GetExtensionIndex failed
V/OMXNodeInstance( 39): enableGraphicBuffers at 301 OMX_GetExtensionIndex returned 2147487745

These 2 error messages are received during initNativeWindow call of the ACodec as part of it's transition from LOADED to IDLE state. 这些2个错误消息期间接收initNativeWindow所述的呼叫ACodec因为它的从转变的部分LOADEDIDLE状态。 From an OMX perspective, as part of the LOADED to IDLE transition, ACodec::LoadedState::onConfigureComponent is invoked. OMX角度来看,作为LOADED to IDLE转换的一部分,将调用ACodec::LoadedState::onConfigureComponent As part of this function, initNativeWindow is invoked. 作为此功能的一部分,将调用initNativeWindow

In initNativeWindow , there are two distinct conditions. initNativeWindow ,有两个不同的条件。 The first case is when the user has provided a nativeWindow or rather a Surface or SurfaceTexture to the codec to write it's output into. 第一种情况是用户为编码解码器提供了nativeWindowSurfaceSurfaceTexture以便将其输出写入。 The other case is when the user hasn't provided a Surface to the MediaPlayer engine. 另一种情况是用户没有向MediaPlayer引擎提供Surface

V/ACodec ( 39): onStart
V/ACodec ( 39): [OMX.google.h264.decoder] Now Loaded->Idle

From these logs, it can be observed that the return code of initNativeWindow is ok which is only possible if the control branched to the case where mNativeNativeWindow is NULL as observed here . 从这些日志中可以看出, initNativeWindow的返回码是可以的只有在控件分支到mNativeNativeWindow为NULL的情况下才有可能 ,如此处观察到的 The return code for the false case is not caught by the ACodec which means that the component transitioned to IDLE state successfully. false案例的返回码未被ACodec捕获,这意味着组件已成功转换到IDLE状态。

In a nutshell, the issue is mainly arising due to a Surface not being provided to the MediaPlayer . 简而言之,问题主要是由于未向MediaPlayer提供Surface引起的。

Some Suggestions: 一些建议:

Since you are employing NuPlayer , I would recommend you to check if NuPlayer::setVideoSurfaceTexture is called and whether a non-NULL object is passed from NuPlayer to downstream components. 由于您正在使用NuPlayer ,因此建议您检查是否NuPlayer::setVideoSurfaceTexture以及是否将non-NULL对象从NuPlayer传递到下游组件。

From a MediaPlayer perspective, you should set a surface as part of the setSurface call. MediaPlayer角度来看,应该将表面设置为setSurface调用的一部分。

In general, you need to provide a sink for the video decoder chain. 在一般情况下,你需要提供一个sink用于视频解码器链。

E/OMXNodeInstance( 39): OMX_GetExtensionIndex failed
V/OMXNodeInstance( 39): enableGraphicBuffers at 301 OMX_GetExtensionIndex returned 2147487745

the call to OMX_GetExtensionIndex lands into SoftOMXComponent( here ) which is just a stubbed function and always returns OMX_ErrorUndefined which leads to failing of enableGraphicBuffers 调用OMX_GetExtensionIndex进入SoftOMXComponent( here ),这只是一个存根函数,并且始终返回OMX_ErrorUndefined ,这会导致enableGraphicBuffers失败

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM