aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-09 07:15:00 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-09 07:15:00 +0000
commit4efbdea6d3d5974935940be5723d680174115717 (patch)
treedd2e1ded5775bf3df9c115c73f0c7741870e9654
parent80e3091e234a963f8791d5509b02037e0906d204 (diff)
parent09a22ed53c5570d329c3e6603d4fe711cec6e309 (diff)
downloadv4l2_codec2-4efbdea6d3d5974935940be5723d680174115717.tar.gz
Snap for 8701348 from 09a22ed53c5570d329c3e6603d4fe711cec6e309 to mainline-ipsec-release
Change-Id: Idb5e58442f603135b5b958e98bf2d5e3784b6b05
-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));