From: davilla Date: Thu, 17 Oct 2013 23:13:19 +0000 (-0400) Subject: droid: change mediacodec to a whitelist for devices that can surface render X-Git-Tag: Gotham_alpha9~83 X-Git-Url: http://code.vuplus.com/gitweb/?a=commitdiff_plain;h=74f8cf0e2517d7a17d2954d65ef6e9a31416e70d;p=vuplus_xbmc droid: change mediacodec to a whitelist for devices that can surface render --- diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp index c9047e4..4db95bb 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp @@ -49,6 +49,23 @@ #include #include +static bool CanSurfaceRenderWhiteList(const std::string &name) +{ + // All devices 'should' be capiable of surface rendering + // but that seems to be hit or miss as most odd name devices + // cannot surface render. + static const char *cansurfacerender_decoders[] = { + "OMX.Nvidia", + NULL + }; + for (const char **ptr = cansurfacerender_decoders; *ptr; ptr++) + { + if (!strcmp(*ptr, name.c_str())) + return true; + } + return false; +} + /*****************************************************************************/ /*****************************************************************************/ class CNULL_Listener : public CJNISurfaceTextureOnFrameAvailableListener @@ -303,12 +320,6 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio break; } - // odroid platform throws trying to updateTexImage with a 'error creating EGLImage' and - // 'unsupported native buffer format (0x13)', sw render them until we figure out why. - if (!m_render_sw) - m_render_sw = g_cpuInfo.getCPUHardware().find("ODROID") != std::string::npos; - - // CJNIMediaCodec::createDecoderByXXX doesn't handle errors nicely, // it crashes if the codec isn't found. This is fixed in latest AOSP, // but not in current 4.1 devices. So 1st search for a matching codec, then create it. @@ -357,6 +368,9 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio return false; } + // whitelist of devices that can surface render. + m_render_sw = CanSurfaceRenderWhiteList(m_codecname); + ConfigureMediaCodec(); // setup a YUV420P DVDVideoPicture buffer. @@ -740,10 +754,10 @@ int CDVDVideoCodecAndroidMediaCodec::GetOutputPicture(void) src_ptr += offset; int loop_end = 0; - if (m_videobuffer.format == RENDER_FMT_YUV420P) - loop_end = 3; - else if (m_videobuffer.format == RENDER_FMT_NV12) + if (m_videobuffer.format == RENDER_FMT_NV12) loop_end = 2; + else if (m_videobuffer.format == RENDER_FMT_YUV420P) + loop_end = 3; for (int i = 0; i < loop_end; i++) {