aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-11 15:42:36 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-11 15:42:36 +0000
commitd89070018b1c7ba648d1dba48b6bb34c5101b5e9 (patch)
treedd2e1ded5775bf3df9c115c73f0c7741870e9654
parent8ba9d707da3f5fe78c3a0fa74e85096d22fc3b81 (diff)
parent39f241ae60695c912854445caca3299f91fb590e (diff)
downloadv4l2_codec2-android13-frc-neuralnetworks-release.tar.gz
Snap for 8712302 from 39f241ae60695c912854445caca3299f91fb590e to tm-frc-neuralnetworks-releaset_frc_neu_330443030t_frc_neu_330443000android13-frc-neuralnetworks-release
Change-Id: If7dc1988e1562dc700626d7be6f014f95acfd5b7
-rw-r--r--components/V4L2EncodeComponent.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/V4L2EncodeComponent.cpp b/components/V4L2EncodeComponent.cpp
index a1b46ab..4ce4404 100644
--- a/components/V4L2EncodeComponent.cpp
+++ b/components/V4L2EncodeComponent.cpp
@@ -756,8 +756,8 @@ bool V4L2EncodeComponent::encode(C2ConstGraphicBlock block, uint64_t index, int6
// Dynamically adjust framerate based on the frame's timestamp if required.
constexpr int64_t kMaxFramerateDiff = 5;
if (mLastFrameTime && (timestamp > *mLastFrameTime)) {
- int64_t newFramerate =
- static_cast<int64_t>(std::round(1000000.0 / (timestamp - *mLastFrameTime)));
+ int64_t newFramerate = std::max(
+ static_cast<int64_t>(std::round(1000000.0 / (timestamp - *mLastFrameTime))), 1LL);
if (abs(mFramerate - newFramerate) > kMaxFramerateDiff) {
ALOGV("Adjusting framerate to %" PRId64 " based on frame timestamps", newFramerate);
mInterface->setFramerate(static_cast<uint32_t>(newFramerate));