Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4844c68 authored by Arun Johnson's avatar Arun Johnson
Browse files

VTS tests for audio updated to handle flags

 - The tests are updated to handle flags for large frame audio.
   The tests now upadted to take audio frame with VTS_BIT_FLAG_SYNC_FRAME
   which is needed for testing flush and eos cases

Bug: 323298405

Change-Id: Ia0b9d051bfe3e915c4742086c6461e273d971fdf
parent 15ff7818
Loading
Loading
Loading
Loading
+32 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "media_c2_hidl_test_common"
#include <stdio.h>

#include <numeric>
#include "media_c2_hidl_test_common.h"

#include <android/hardware/media/c2/1.0/IComponentStore.h>
@@ -221,6 +221,32 @@ const std::vector<TestParameters>& getTestParameters(C2Component::domain_t domai
    return parameters;
}

constexpr static std::initializer_list<std::pair<uint32_t, uint32_t>> flagList{
        {(1 << VTS_BIT_FLAG_SYNC_FRAME), 0},
        {(1 << VTS_BIT_FLAG_CSD_FRAME), C2FrameData::FLAG_CODEC_CONFIG},
};

/*
 * This is a conversion function that can be used to convert
 * VTS flags to C2 flags and vice-versa based on the initializer list.
 * @param flags can be a C2 flag or a VTS flag
 * @param toC2 if true, converts flags to a C2 flag
 *              if false, converts flags to a VTS flag
 */
static uint32_t convertFlags(uint32_t flags, bool toC2) {
    return std::transform_reduce(
            flagList.begin(), flagList.end(),
            0u,
            std::bit_or{},
            [flags, toC2](const std::pair<uint32_t, uint32_t> &entry) {
                if (toC2) {
                    return (flags & entry.first) ? entry.second : 0;
                } else {
                    return (flags & entry.second) ? entry.first : 0;
                }
            });
}

// Populate Info vector and return number of CSDs
int32_t populateInfoVector(std::string info, android::Vector<FrameInfo>* frameInfo,
                           bool timestampDevTest, std::list<uint64_t>* timestampUslist) {
@@ -258,9 +284,9 @@ int32_t populateInfoVector(std::string info, android::Vector<FrameInfo>* frameIn
                eleInfo >> bytesCount;
                eleInfo >> flags;
                eleInfo >> timestamp;
                vtsFlags = mapInfoFlagstoVtsFlags(flags);
                uint32_t c2Flags = convertFlags(flags, true);
                frameInfo->editItemAt(frameInfo->size() - 1).largeFrameInfo.push_back(
                        {vtsFlags, static_cast<uint32_t>(bytesCount), timestamp});
                        {c2Flags, static_cast<uint32_t>(bytesCount), timestamp});
            }
        }
    }
@@ -298,5 +324,8 @@ int mapInfoFlagstoVtsFlags(int infoFlags) {
    else if (infoFlags == 0x10) return (1 << VTS_BIT_FLAG_NO_SHOW_FRAME);
    else if (infoFlags == 0x20) return (1 << VTS_BIT_FLAG_CSD_FRAME);
    else if (infoFlags == 0x40) return (1 << VTS_BIT_FLAG_LARGE_AUDIO_FRAME);
    else if (infoFlags == 0x80) {
        return (1 << VTS_BIT_FLAG_LARGE_AUDIO_FRAME) | (1 << VTS_BIT_FLAG_SYNC_FRAME);
    }
    return 0xFF;
}
+5 −5
Original line number Diff line number Diff line
16384 64 0 		 1 16384 1 0
49152 64 1024000 3 16384 1 1024000 16384 1 2048000 16384 1 3072000
32768 64 4096000 2 16384 1 4096000 16384 1 5120000
49152 64 6144000 3 16384 1 6144000 16384 1 7168000 16384 1 8192000
10924 64 9216000 1 10924 1 9216000
16384 128 0 		 1 16384 1 0
49152 128 1024000 3 16384 1 1024000 16384 1 2048000 16384 1 3072000
32768 128 4096000 2 16384 1 4096000 16384 1 5120000
49152 128 6144000 3 16384 1 6144000 16384 1 7168000 16384 1 8192000
10924 128 9216000 1 10924 1 9216000