diff options
author | Steven Thomas <steventhomas@google.com> | 2020-01-23 19:40:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-01-23 19:40:20 +0000 |
commit | 8c9f31b8b0cfff3d45a690609ee05fdb96e54bb9 (patch) | |
tree | c06779d8a8c0b1ef5bf63a5d2615a241843516e7 /native/android/surface_control.cpp | |
parent | ffd216dfa2acd763f9768b99820b304e59668f69 (diff) | |
parent | 6cf051ef8909be67f3fa7d6212a510d58e63df35 (diff) |
Merge "Add setFrameRate() api"
Diffstat (limited to 'native/android/surface_control.cpp')
-rw-r--r-- | native/android/surface_control.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index b34b31ac8439..392c9f6404ba 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -545,3 +545,18 @@ void ASurfaceTransaction_setColor(ASurfaceTransaction* aSurfaceTransaction, transaction->setBackgroundColor(surfaceControl, color, alpha, static_cast<ui::Dataspace>(dataspace)); } + +void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* aSurfaceTransaction, + ASurfaceControl* aSurfaceControl, float frameRate) { + CHECK_NOT_NULL(aSurfaceTransaction); + CHECK_NOT_NULL(aSurfaceControl); + + sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl); + if (frameRate < 0) { + ALOGE("Failed to set frame ate - invalid frame rate"); + return; + } + + Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction); + transaction->setFrameRate(surfaceControl, frameRate); +} |