Skip to content
Snippets Groups Projects
Commit 50a7a415 authored by Michał Krawczyk's avatar Michał Krawczyk
Browse files

EncodeComponent: clamp dynamic framerate for H264

The user app can provide buffers to the encoder directly via MediaCodec
API (queueInputBuffer) or via InputSurface.

In case the input surface is used, the timestamps of the encoded frames
are automatically generated, as they're being considered as a real-time
traffic (for example - from screen capture session or the camera input).

Also the Component is supposed to dynamically adjust the framerate based
on the input frames timestamps (see b/192419592).

The dynamic framerate calculation may provide extreme framerate values,
which will cause encoder failures because of too high MBPS for the given
profile. One such case was detected by test
android.media.codec.cts.MediaCodecTest#testAbruptStop after OMX removal.

As the CTS test itself can generate such values, the encoder was
updated to calculate the maximum allowed framerate for the input frame
size and output level. Then this value is used to limit the dynamic
framerate calculations. As it can be potentially an app error, the
warning is printed whenever this happens.

Note: this is currently done only for H264. For other codecs the
clamping won't be effective, as the maximum allowed framerate is set to
uint32_t::max().

Bug: 295339810
Bug: 362902868
Test: android.media.codec.cts.MediaCodecTest#testAbruptStop
Test: com.google.android.media.gts.RtcVideoCodecTest#testDynamicFramerateChangeVp8
Change-Id: I783493453d762886a10996d0ad9821149cafb014
parent b4c7f490
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment