Add a way to force a frame to be sent from SurfaceTextureHelper

This allows forcing a minimum frame rate if the producer doesn’t update
the SurfaceTexture often.

This needs to be done in SurfaceTextureHelper to keep the
synchronization of the texture access consistent.

Bug: b/149383039
Change-Id: I0e3c82dd51d486b931bd8dda0fd9d5cdb1a90901
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177001
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Xavier Lepaul <xalep@google.com>
Cr-Commit-Position: refs/heads/master@{#31504}
This commit is contained in:
Xavier Lepaul
2020-06-11 14:03:56 +02:00
committed by Commit Bot
parent ac937d03b0
commit f0ab6a0169

View File

@ -263,6 +263,17 @@ public class SurfaceTextureHelper {
});
}
/**
* Forces a frame to be produced. If no new frame is available, the last frame is sent to the
* listener again.
*/
public void forceFrame() {
handler.post(() -> {
hasPendingTexture = true;
tryDeliverTextureFrame();
});
}
/** Set the rotation of the delivered frames. */
public void setFrameRotation(int rotation) {
handler.post(() -> this.frameRotation = rotation);