Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 41eb8da8 authored by Chong Zhang's avatar Chong Zhang
Browse files

heif: reserve item ids at track start

When multiple images are encoded, samples from different
image tracks could arrive almost simultaneously. If the writer
thread is busy writing when bufferChunk is called, multiple
tracks could get blocked on the mLock, and when the writer
enters wait, a random track will be awakened to queue the sample,
not following the original order when they got blocked.

This will result in the images not being sorted to the original
specified order. The file is still well-formed and the primary
index will point to the correct image content, but the re-ordering
could be undesirable (and unexpected by the client).

Fixing this by reserving the item ids for image tracks upfront.
Actual samples could be written at random order, but item ids
will be preserved.

bug: 147111445
test: android.media.cts.HeifWriterTest#testInputBuffer_NoGrid*
modified to run 100x

Change-Id: I62ceca5ab2a04f2ebbf5825b667b8f34ae798041
parent 684e4758
Loading
Loading
Loading
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