Skip to content

Commit

Permalink
encapp: Fix for SurfaceTranscoder stuck with realtime mode
Browse files Browse the repository at this point in the history
Now surface transcode will run as fast as possible unless input.realtime is set.

TODO:
When realtime is set there is a problem with the first few seconds with uneven
framerate as the codecs are filling up their deep pipelines (?).

Signed-off-by: JohanBlome <[email protected]>
  • Loading branch information
JohanBlome committed Dec 6, 2024
1 parent c067267 commit 7c51e48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 14 additions & 3 deletions app/src/main/java/com/facebook/encapp/SurfaceEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,12 @@ protected void checkRealtime() {
// Without it the extractor will read as fast a possible
// until no buffers are available.
mRealtime = true;
} else {
if (mOutputMult != null)
mOutputMult.setRealtime(false);
}
}
if (!mRealtime) {
if (mOutputMult != null) {
Log.d(TAG, "Outputmultiplier will work in non realtime mode");
mOutputMult.setRealtime(false);
}
}
}
Expand All @@ -447,6 +450,14 @@ private void setupOutputMult(int width, int height) {
if (mOutputMult != null) {
mOutputMult.setName("SE_" + mTest.getInput().getFilepath() + "_enc-" + mTest.getConfigure().getCodec());
mOutputMult.confirmSize(width, height);

// Need to update outputmulti and configure working mode.
if (!mRealtime) {
if (mOutputMult != null) {
Log.d(TAG, "Outputmultiplier will work in non realtime mode");
mOutputMult.setRealtime(false);
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class SurfaceTranscoder extends SurfaceEncoder implements VsyncListener {
MediaExtractor mExtractor;
MediaCodec mDecoder;
DecoderRuntime mDecoderRuntimeParams;
OutputMultiplier mOutputMult = null;
double mLoopTime = 0;
int mCurrentLoop = 1;
long mPtsOffset = 0;
Expand Down

0 comments on commit 7c51e48

Please sign in to comment.