Skip to content

Commit

Permalink
stagefright: Set native color format for the Native window
Browse files Browse the repository at this point in the history
WIP: Tried to shim this code via mediaserver, which worked partially.
However when using apps like YouTube, it doesn't get shimmed, so
reintroduce this again.

Change-Id: Iafe034d00c8081a621c4a3d60a2c321c3c542b91
  • Loading branch information
rINanDO committed Jan 29, 2019
1 parent 54df22c commit 19ab8af
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion media/libstagefright/ACodec.cpp
Expand Up @@ -1112,12 +1112,39 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(
memset(&mLastNativeWindowCrop, 0, sizeof(mLastNativeWindowCrop));
mLastNativeWindowDataSpace = HAL_DATASPACE_UNKNOWN;

// In case of Samsung decoders, we set proper native color format for the Native Window
enum {
HAL_PIXEL_FORMAT_YCbCr_420_P = 0x101,
HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x105,
};

OMX_COLOR_FORMATTYPE eNativeColorFormat = def.format.video.eColorFormat;
if (!strcasecmp(mComponentName.c_str(), "OMX.SEC.AVC.Decoder")
|| !strcasecmp(mComponentName.c_str(), "OMX.SEC.FP.AVC.Decoder")
|| !strcasecmp(mComponentName.c_str(), "OMX.SEC.MPEG4.Decoder")
|| !strcasecmp(mComponentName.c_str(), "OMX.Exynos.AVC.Decoder")) {
switch (eNativeColorFormat) {
case OMX_COLOR_FormatYUV420SemiPlanar:
eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_SP;
break;
case OMX_COLOR_FormatYUV420Planar:
default:
eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_P;
break;
}
ALOGD("%s: %s colorformat:%d => %d", __func__, mComponentName.c_str(),
def.format.video.eColorFormat, eNativeColorFormat);
} else {
ALOGD("%s: %s colorformat:%d", __func__, mComponentName.c_str(), eNativeColorFormat);
}


ALOGV("gralloc usage: %#x(OMX) => %#x(ACodec)", omxUsage, usage);
return setNativeWindowSizeFormatAndUsage(
nativeWindow,
def.format.video.nFrameWidth,
def.format.video.nFrameHeight,
def.format.video.eColorFormat,
eNativeColorFormat,
mRotationDegrees,
usage,
reconnect);
Expand Down

0 comments on commit 19ab8af

Please sign in to comment.