我需要有关Samsung S9 +的帮助。我要做的就是创建一个解码器,然后将其配置为渲染到表面。配置步骤失败。请参见下面的代码和日志。
我对颜色格式有误吗?该代码可在其他设备上正常运行,但不能在Samsung S9 +上运行。我尝试给它提供以下值,但无济于事:
COLOR_FormatSurface
在API级别18中添加 公共静态最终int COLOR_FormatSurface
常量值:2130708361(0x7f000789)
void func(AMediaFormat* mediaFormat, ANativeWindow* surface)
{
// ...
AMediaFormat_getString(mediaFormat, AMEDIAFORMAT_KEY_MIME, &mime);
AMediaCodec *videoDecoder = AMediaCodec_createDecoderByType(mime);
// this step is failing
media_status_t status = AMediaCodec_configure(videoDecoder, mediaFormat, surface, NULL, 0);
// ...
}
2019-04-02 11:25:48.578 999-17684/? E/OMX-VDEC-1080P: Unsupported output color format for c2d (2141391876)
2019-04-02 11:25:48.578 999-17684/? E/OMX-VDEC-1080P: Setting color format failed
2019-04-02 11:25:48.606 999-17684/? E/OMX-VDEC-1080P: Unsupported output color format for c2d (2141391876)
2019-04-02 11:25:48.606 999-17684/? E/OMX-VDEC-1080P: Setting color format failed
2019-04-02 11:25:48.613 15598-18889 E/NdkMediaCodec: configure: err(-5001), failed with format: AMessage(what = 0x00000000) = {
string mime = "video/avc"
int64_t durationUs = 91604722
int32_t isDMCMMExtractor = 1
int32_t track-id = 1
string language = "```"
int32_t width = 3840
int32_t height = 2160
int32_t display-width = 3840
int32_t display-height = 2160
int32_t color-range = 2
int32_t color-standard = 6
int32_t color-transfer = 3
int32_t max-input-size = 6291456
int32_t frame-rate = 30
int32_t profile = 8
int32_t level = 32768
Buffer csd-0 = {
00000000: 00 00 00 01 67 64 00 33 ac d2 00 f0 01 0f a5 60 ....gd.3.......`
00000010: c0 c0 c0 da 14 26 a0 .....&.
}
Buffer csd-1 = {
00000000: 00 00 00 01 68 ee 06 e2 c0 ....h....
}
int32_t color-format = 2130708361
RefBase *native-window = 0x73221a0000
}