Commit 6f0f7dd1 by hschlueter Committed by tonihei

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
parent 9f6cdb4c
...@@ -148,8 +148,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment