I would like to decode and play two videos simultaneously. My code isn't very complicated, you can see decoder configuring part below. It's based on google/grafika's MoviePlayer.
final String mime = format1.getString(MediaFormat.KEY_MIME);
decoder1 = MediaCodec.createDecoderByType(mime);
decoder1.configure(format1, mOutputSurface1, null, 0);
decoder1.start();
decoder2 = MediaCodec.createDecoderByType(mime);
decoder2.configure(format2, mOutputSurface2, null, 0);
decoder2.start();
This worked great with videos up to 1080p, but when I tried to play 4K video, second decoder failed to configure with errors:
E/ACodec﹕ configureCodec multi window instance fail appPid : 13182
E/ACodec﹕ [OMX.qcom.video.decoder.avc] configureCodec returning error -38
E/MediaCodec﹕ Codec reported an error. (omx error 0x80001001, internalError -38)
If I would leave only one decoder, it would work just fine even with 4K videos. I have found some discussion in this question, but I'm not sure it's related to my problem. I can confirm this happens on Samsung Galaxy S6 and Samsung Galaxy Note 4.
Is there any way to make two decoders work with 4K videos?