diff options
author | Trent Nelson <trent.a.b.nelson@gmail.com> | 2014-04-16 09:07:36 -0600 |
---|---|---|
committer | Trent Nelson <trent.a.b.nelson@gmail.com> | 2014-04-16 16:07:10 -0600 |
commit | c61ed1957d5d4e04f3a929a74e115db288fea364 (patch) | |
tree | bd702773ff534289843fc7096a665d1bda8e76cb | |
parent | 0a5b020350e0d6bf9a35fb6785e739c325373656 (diff) |
Merge pull request #4549 from koying/fixamcinitcolor
FIX: [mediacodec] fixup initial output format for software rendering
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp | 13 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp index ab161de3a0..41ebb3c79e 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp @@ -374,7 +374,7 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio // 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. - bool hasSupportedColorFormat = false; + m_colorFormat = -1; int num_codecs = CJNIMediaCodecList::getCodecCount(); for (int i = 0; i < num_codecs; i++) { @@ -404,13 +404,13 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio m_codec.reset(); continue; } - hasSupportedColorFormat = false; + for (size_t k = 0; k < color_formats.size(); ++k) { CLog::Log(LOGDEBUG, "CDVDVideoCodecAndroidMediaCodec::Open " "m_codecname(%s), colorFormat(%d)", m_codecname.c_str(), color_formats[k]); if (IsSupportedColorFormat(color_formats[k])) - hasSupportedColorFormat = true; + m_colorFormat = color_formats[k]; // Save color format for initial output configuration } break; } @@ -429,7 +429,7 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio m_render_sw = !CanSurfaceRenderWhiteList(m_codecname); if (m_render_sw) { - if (!hasSupportedColorFormat) + if (m_colorFormat == -1) { CLog::Log(LOGERROR, "CDVDVideoCodecAndroidMediaCodec:: No supported color format"); m_codec.reset(); @@ -773,7 +773,7 @@ bool CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec(void) return false; } - // There is no guarantee we'll get an INFO_OUTPUT_FORMAT_CHANGED + // There is no guarantee we'll get an INFO_OUTPUT_FORMAT_CHANGED (up to Android 4.3) // Configure the output with defaults ConfigureOutputFormat(&mediaformat); @@ -941,6 +941,9 @@ void CDVDVideoCodecAndroidMediaCodec::ConfigureOutputFormat(CJNIMediaFormat* med width = stride = m_hints.width; height = slice_height = m_hints.height; } + // No color-format? Initialize with the one we detected as valid earlier + if (color_format == 0) + color_format = m_colorFormat; if (stride <= width) stride = width; if (!crop_right) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h index 0dea4a3790..50dacaec89 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h @@ -117,6 +117,7 @@ protected: CDVDStreamInfo m_hints; std::string m_mime; std::string m_codecname; + int m_colorFormat; const char *m_formatname; bool m_opened; bool m_drop; |