What is the use of TimeU views for MediaCodec?

The official definition of presentationTimeUs in queueInputBuffer (int index, int offset, int size, long presentationTimeUs, int flags) is as follows:

The microsecond representation timestamp for this buffer. This is usually the time during which this buffer must be submitted (rendered).

Why does the decoder need this, if before the application, when it is necessary to present a decoded image? I tried some arbitrary numbers for presentationTimeU, and they don't seem to have anything to do with decoding. For example, if I double the original presentationTimeU, the video seems to be decoded in the exact same way and at the same speed as the original.

Can anyone shed some light on this?

+5
source share
1 answer

decoder must know the timestamps input buffer for several reasons.

First , if a stream has B-frames , then reordering the buffers and assigning the correct timestamps to the buffers is done using a decoder . Therefore, when timestamps received in the input buffer, it will be queued for reordering.

Secondly, if the use case is something like Android-TV , which infact has tunneled video playback , a timestamp consumed by a video decoder that tunnels with the base HW block for synchronization and rendering.

Finally, if there is any drop in packets or frames, the decoder can potentially perform some kind of hiding if it notices a sharp transition in timestamps without calling a flash. This is not the norm, but an extended function of some decoders.

In traditional cases, as you indicated, synchronization is performed by the player engine, in which the decoder reflects the timestamp of the input buffer into the output buffer.

+2
source

All Articles