Adjust timestamp even if frame is dropped.
The `SefSlowMotionVideoSampleTransformer` drops frames by setting `buffer.data = null` and updates the timestamps of the frames it keeps. However, these buffers with dropped frames are still used in the pipeline as they may contain other useful information, specifically whether the end of the input has been reached. So, the timestamps should also be updated for the buffers where frames are dropped. PiperOrigin-RevId: 410797678
This commit is contained in:
parent
9e2348f4c3
commit
ac8e418f3d
@ -148,8 +148,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
"Missing SVC extension prefix NAL unit.");
|
"Missing SVC extension prefix NAL unit.");
|
||||||
int layer = (scratch[3] & 0xFF) >> 5;
|
int layer = (scratch[3] & 0xFF) >> 5;
|
||||||
boolean shouldKeepFrame = processCurrentFrame(layer, buffer.timeUs);
|
boolean shouldKeepFrame = processCurrentFrame(layer, buffer.timeUs);
|
||||||
if (shouldKeepFrame) {
|
// Update buffer timestamp regardless of whether the frame is dropped because the buffer might
|
||||||
|
// still be passed to a decoder if it contains an end of stream flag.
|
||||||
buffer.timeUs = getCurrentFrameOutputTimeUs(/* inputTimeUs= */ buffer.timeUs);
|
buffer.timeUs = getCurrentFrameOutputTimeUs(/* inputTimeUs= */ buffer.timeUs);
|
||||||
|
if (shouldKeepFrame) {
|
||||||
skipToNextNalUnit(data); // Skip over prefix_nal_unit_svc.
|
skipToNextNalUnit(data); // Skip over prefix_nal_unit_svc.
|
||||||
} else {
|
} else {
|
||||||
buffer.data = null;
|
buffer.data = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user