LiTr icon indicating copy to clipboard operation
LiTr copied to clipboard

Video encoding doesn't work in Android 14

Open tobias-r opened this issue 2 years ago • 8 comments

Hi there,

encode a video isn't working anymore since Android 14.

final MediaTransformer mediaTransformer = new MediaTransformer(getApplicationContext());

TransformationListener transformationListener = new TransformationListener() { ... }

mediaTransformer.transform( ... );

In Android 13, all works perfectly fine with the same code, since Android 14 it stops after 1 sec without any error callbacks. The onProgress callback is called 1-2 times.

2023-10-21 08:51:59.171 15592-15592 TAG                   com.myproject.android                 D  LiTr onProgress
2023-10-21 08:52:03.950 15592-15837 BufferPoolAccessor2.0   com.myproject.android                 D  evictor expired: 1, evicted: 0
2023-10-21 08:52:04.951 15592-15837 BufferPoolAccessor2.0   com.myproject.android                 D  bufferpool2 0xb4000070c36c7e38 : 5(40960 size) total buffers - 4(32768 size) used buffers - 28/34 (recycle/alloc) - 6/30 (fetch/transfer)
2023-10-21 08:52:04.951 15592-15837 BufferPoolAccessor2.0   com.myproject.android                 D  bufferpool2 0xb4000070c36d34e8 : 5(20480 size) total buffers - 0(0 size) used buffers - 18/24 (recycle/alloc) - 5/46 (fetch/transfer)
2023-10-21 08:52:04.951 15592-15837 BufferPoolAccessor2.0   com.myproject.android                 D  bufferpool2 0xb4000070c3734b88 : 0(0 size) total buffers - 0(0 size) used buffers - 0/0 (recycle/alloc) - 0/0 (fetch/transfer)
2023-10-21 08:52:04.951 15592-15837 BufferPoolAccessor2.0   com.myproject.android                 D  bufferpool2 0xb4000070c36fa798 : 5(36700160 size) total buffers - 4(29360128 size) used buffers - 18/23 (recycle/alloc) - 9/19 (fetch/transfer)
2023-10-21 08:52:04.951 15592-15837 BufferPoolAccessor2.0   com.myproject.android                 D  evictor expired: 4, evicted: 4

Just guessing in the wild, is it the reduced mLock Limit?

Tobias

tobias-r avatar Oct 21 '23 06:10 tobias-r

Thank for catching this. I will get ahold of Android 14 device and investigate this.

izzytwosheds avatar Oct 24 '23 15:10 izzytwosheds

Any news on this one? 😇 Are we the only ones?

tobias-r avatar Nov 11 '23 09:11 tobias-r

Apologies for the delay. Looking into this now.

izzytwosheds avatar Nov 15 '23 14:11 izzytwosheds

Which device are you using? Things seem to be working well on emulator.

izzytwosheds avatar Nov 15 '23 14:11 izzytwosheds

True, in the emulator it works for me too. But on my Pixel 6a it doesn't. Also quite a few app users complained. Can you reproduce it?

tobias-r avatar Nov 18 '23 15:11 tobias-r

We were not able to reproduce it on Pixel devices (I don't exactly know which ones, I will ask) I will try to get ahold of a Pixel 6a and debug.

izzytwosheds avatar Nov 18 '23 16:11 izzytwosheds

Just checked on a Samsung device and it worked too. The problem also is, it doesn't throw an error, the service that is processing the video simply crashes, no callbacks.

tobias-r avatar Nov 19 '23 11:11 tobias-r

Hi izzy, so I did some debugging on my Pixel 6a, and the problem only occurs with a video target format: targetVideoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible); COLOR_FormatYUV422Flexible works! Is this something you can fix? I can do more tests, if you let me know.

tobias-r avatar Nov 19 '23 12:11 tobias-r