Skip to content
Snippets Groups Projects
Commit 3db9508b authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Alex Courbot
Browse files

V4L2EncodeComponent: fix build error

Patch 0fa30254bd7e introduced a type mismatch when building for 32-bit architecture. This error is visible when running "mmm external/v4l2_codec2":

    external/v4l2_codec2/components/V4L2EncodeComponent.cpp:782:32: error: no matching function for call to 'max'
            int64_t newFramerate = std::max(
                                   ^~~~~~~~
    external/libcxx/include/algorithm:2529:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long' vs. 'long long')
    max(const _Tp& __a, const _Tp& __b)
    ^
    external/libcxx/include/algorithm:2539:1: note: candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'long'
    max(initializer_list<_Tp> __t, _Compare __comp)
    ^
    external/libcxx/include/algorithm:2547:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided
    max(initializer_list<_Tp> __t)
    ^
    external/libcxx/include/algorithm:2521:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^

Fix this by casting the right member of the cmp operation to int64_t.

Test: mmm external/v4l2_codec2

Change-Id: Id2cc220b9122eec412823f577f07ecd82bad60fc
(cherry picked from commit a0377993b84da09547aad11f2f27560e0bf4dcd5)
parent 39f241ae
No related branches found
No related tags found
No related merge requests found
......@@ -757,7 +757,8 @@ bool V4L2EncodeComponent::encode(C2ConstGraphicBlock block, uint64_t index, int6
constexpr int64_t kMaxFramerateDiff = 5;
if (mLastFrameTime && (timestamp > *mLastFrameTime)) {
int64_t newFramerate = std::max(
static_cast<int64_t>(std::round(1000000.0 / (timestamp - *mLastFrameTime))), 1LL);
static_cast<int64_t>(std::round(1000000.0 / (timestamp - *mLastFrameTime))),
static_cast<int64_t>(1LL));
if (abs(mFramerate - newFramerate) > kMaxFramerateDiff) {
ALOGV("Adjusting framerate to %" PRId64 " based on frame timestamps", newFramerate);
mInterface->setFramerate(static_cast<uint32_t>(newFramerate));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment