Skip to content

Commit

Permalink
encapp: do not waste peoples times
Browse files Browse the repository at this point in the history
Only wait if needed.

Signed-off-by: JohanBlome <[email protected]>
  • Loading branch information
JohanBlome committed May 23, 2024
1 parent a163ac7 commit 8bf9263
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/com/facebook/encapp/SurfaceTranscoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,13 @@ public long sleepUntilNextFrameSynched() {

public void stopAllActivity(){
synchronized (mStopLock) {
Log.d(TAG, "Give me a sec, waiting for last encodings dec: " + mStats.getDecodedFrameCount() + " > enc: " + mStats.getEncodedFrameCount());
try {
mStopLock.wait(WAIT_TIME_SHORT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
if (mStats.getDecodedFrameCount() > mStats.getEncodedFrameCount()) {
Log.d(TAG, "Give me a sec, waiting for last encodings dec: " + mStats.getDecodedFrameCount() + " > enc: " + mStats.getEncodedFrameCount());
try {
mStopLock.wait(WAIT_TIME_SHORT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
mDone = true;
mStats.stop();
Expand Down

0 comments on commit 8bf9263

Please sign in to comment.