@ -19,21 +19,20 @@
# include <android-base/logging.h>
# include <gtest/gtest.h>
# include < algorithm >
# include < hidl/GtestPrinter.h >
# include <stdio.h>
# include <algorithm>
# include <fstream>
# include <codec2/hidl/client.h>
# include <C2AllocatorIon.h>
# include <C2Config.h>
# include <C2Debug.h>
# include <C2Buffer.h>
# include <C2BufferPriv.h>
# include <C2Config.h>
# include <C2Debug.h>
# include <codec2/hidl/client.h>
using android : : C2AllocatorIon ;
# include <VtsHalHidlTargetTestBase.h>
# include "media_c2_audio_hidl_test_common.h"
# include "media_c2_hidl_test_common.h"
struct FrameInfo {
@ -42,57 +41,44 @@ struct FrameInfo {
int64_t timestamp ;
} ;
static std : : vector < std : : tuple < std : : string , std : : string , std : : string , std : : string > >
kDecodeTestParameters ;
// Resource directory
static std : : string sResourceDir = " " ;
class LinearBuffer : public C2Buffer {
public :
public :
explicit LinearBuffer ( const std : : shared_ptr < C2LinearBlock > & block )
: C2Buffer (
{ block - > share ( block - > offset ( ) , block - > size ( ) , : : C2Fence ( ) ) } ) { }
: C2Buffer ( { block - > share ( block - > offset ( ) , block - > size ( ) , : : C2Fence ( ) ) } ) { }
} ;
static ComponentTestEnvironment * gEnv = nullptr ;
namespace {
class Codec2AudioDecHidlTest : public : : testing : : VtsHalHidlTargetTestBase {
private :
typedef : : testing : : VtsHalHidlTargetTestBase Super ;
public :
: : std : : string getTestCaseInfo ( ) const override {
return : : std : : string ( ) +
" Component: " + gEnv - > getComponent ( ) . c_str ( ) + " | " +
" Instance: " + gEnv - > getInstance ( ) . c_str ( ) + " | " +
" Res: " + gEnv - > getRes ( ) . c_str ( ) ;
}
class Codec2AudioDecHidlTestBase : public : : testing : : Test {
public :
// google.codec2 Audio test setup
virtual void SetUp ( ) override {
Super: : SetUp ( ) ;
getParams ( ) ;
mDisableTest = false ;
ALOGV ( " Codec2AudioDecHidlTest SetUp " ) ;
mClient = android : : Codec2Client : : CreateFromService (
gEnv - > getInstance ( ) . c_str ( ) ,
! bool ( android : : Codec2Client : : CreateFromService ( " default " , true ) ) ) ;
mInstanceName . c_str ( ) ,
! bool ( android : : Codec2Client : : CreateFromService ( " default " , true ) ) ) ;
ASSERT_NE ( mClient , nullptr ) ;
mListener . reset ( new CodecListener (
[ this ] ( std : : list < std : : unique_ptr < C2Work > > & workItems ) {
handleWorkDone ( workItems ) ;
} ) ) ;
mListener . reset ( new CodecListener ( [ this ] ( std : : list < std : : unique_ptr < C2Work > > & workItems ) {
handleWorkDone ( workItems ) ;
} ) ) ;
ASSERT_NE ( mListener , nullptr ) ;
for ( int i = 0 ; i < MAX_INPUT_BUFFERS ; + + i ) {
mWorkQueue . emplace_back ( new C2Work ) ;
}
mClient - > createComponent ( gEnv - > getComponent ( ) . c_str ( ) , mListener ,
& mComponent ) ;
mClient - > createComponent ( mComponentName , mListener , & mComponent ) ;
ASSERT_NE ( mComponent , nullptr ) ;
std : : shared_ptr < C2AllocatorStore > store =
android : : GetCodec2PlatformAllocatorStore ( ) ;
CHECK_EQ ( store - > fetchAllocator ( C2AllocatorStore : : DEFAULT_LINEAR ,
& mLinearAllocator ) ,
C2_OK ) ;
mLinearPool = std : : make_shared < C2PooledBlockPool > ( mLinearAllocator ,
mBlockPoolId + + ) ;
std : : shared_ptr < C2AllocatorStore > store = android : : GetCodec2PlatformAllocatorStore ( ) ;
CHECK_EQ ( store - > fetchAllocator ( C2AllocatorStore : : DEFAULT_LINEAR , & mLinearAllocator ) , C2_OK ) ;
mLinearPool = std : : make_shared < C2PooledBlockPool > ( mLinearAllocator , mBlockPoolId + + ) ;
ASSERT_NE ( mLinearPool , nullptr ) ;
mCompName = unknown_comp ;
@ -101,27 +87,17 @@ class Codec2AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
standardComp CompName ;
} ;
const StringToName kStringToName [ ] = {
{ " xaac " , xaac } ,
{ " mp3 " , mp3 } ,
{ " amrnb " , amrnb } ,
{ " amrwb " , amrwb } ,
{ " aac " , aac } ,
{ " vorbis " , vorbis } ,
{ " opus " , opus } ,
{ " pcm " , pcm } ,
{ " g711.alaw " , g711alaw } ,
{ " g711.mlaw " , g711mlaw } ,
{ " gsm " , gsm } ,
{ " raw " , raw } ,
{ " flac " , flac } ,
{ " xaac " , xaac } , { " mp3 " , mp3 } , { " amrnb " , amrnb } ,
{ " amrwb " , amrwb } , { " aac " , aac } , { " vorbis " , vorbis } ,
{ " opus " , opus } , { " pcm " , pcm } , { " g711.alaw " , g711alaw } ,
{ " g711.mlaw " , g711mlaw } , { " gsm " , gsm } , { " raw " , raw } ,
{ " flac " , flac } ,
} ;
const size_t kNumStringToName =
sizeof ( kStringToName ) / sizeof ( kStringToName [ 0 ] ) ;
const size_t kNumStringToName = sizeof ( kStringToName ) / sizeof ( kStringToName [ 0 ] ) ;
// Find the component type
std : : string comp = std : : string ( gEnv - > getComponent ( ) ) ;
for ( size_t i = 0 ; i < kNumStringToName ; + + i ) {
if ( strcasestr ( comp . c_str ( ) , kStringToName [ i ] . Name ) ) {
if ( strcasestr ( mComponentName . c_str ( ) , kStringToName [ i ] . Name ) ) {
mCompName = kStringToName [ i ] . CompName ;
break ;
}
@ -140,9 +116,11 @@ class Codec2AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
mComponent - > release ( ) ;
mComponent = nullptr ;
}
Super : : TearDown ( ) ;
}
// Get the test parameters from GetParam call.
virtual void getParams ( ) { }
struct outputMetaData {
uint64_t timestampUs ;
uint32_t rangeLength ;
@ -155,25 +133,27 @@ class Codec2AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
// previous timestamp
bool codecConfig = ( ( work - > worklets . front ( ) - > output . flags &
C2FrameData : : FLAG_CODEC_CONFIG ) ! = 0 ) ;
if ( ! codecConfig & &
! work - > worklets . front ( ) - > output . buffers . empty ( ) ) {
if ( ! codecConfig & & ! work - > worklets . front ( ) - > output . buffers . empty ( ) ) {
EXPECT_GE ( work - > worklets . front ( ) - > output . ordinal . timestamp . peeku ( ) ,
mTimestampUs ) ;
mTimestampUs =
work - > worklets . front ( ) - > output . ordinal . timestamp . peeku ( ) ;
uint32_t rangeLength =
work - > worklets . front ( ) - > output . buffers [ 0 ] - > data ( )
. linearBlocks ( ) . front ( ) . map ( ) . get ( ) . capacity ( ) ;
//List of timestamp values and output size to calculate timestamp
mTimestampUs ) ;
mTimestampUs = work - > worklets . front ( ) - > output . ordinal . timestamp . peeku ( ) ;
uint32_t rangeLength = work - > worklets . front ( )
- > output . buffers [ 0 ]
- > data ( )
. linearBlocks ( )
. front ( )
. map ( )
. get ( )
. capacity ( ) ;
// List of timestamp values and output size to calculate timestamp
if ( mTimestampDevTest ) {
outputMetaData meta = { mTimestampUs , rangeLength } ;
oBufferMetaData . push_back ( meta ) ;
}
}
bool mCsd = false ;
workDone ( mComponent , work , mFlushedIndices , mQueueLock ,
mQueueCondition , mWorkQueue , mEos , mCsd ,
mFramesReceived ) ;
workDone ( mComponent , work , mFlushedIndices , mQueueLock , mQueueCondition , mWorkQueue ,
mEos , mCsd , mFramesReceived ) ;
( void ) mCsd ;
}
}
@ -196,6 +176,8 @@ class Codec2AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
unknown_comp ,
} ;
std : : string mInstanceName ;
std : : string mComponentName ;
bool mEos ;
bool mDisableTest ;
bool mTimestampDevTest ;
@ -218,15 +200,23 @@ class Codec2AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
std : : shared_ptr < android : : Codec2Client : : Listener > mListener ;
std : : shared_ptr < android : : Codec2Client : : Component > mComponent ;
protected :
protected :
static void description ( const std : : string & description ) {
RecordProperty ( " description " , description ) ;
}
} ;
void validateComponent (
const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
Codec2AudioDecHidlTest : : standardComp compName , bool & disableTest ) {
class Codec2AudioDecHidlTest
: public Codec2AudioDecHidlTestBase ,
public : : testing : : WithParamInterface < std : : tuple < std : : string , std : : string > > {
void getParams ( ) {
mInstanceName = std : : get < 0 > ( GetParam ( ) ) ;
mComponentName = std : : get < 1 > ( GetParam ( ) ) ;
}
} ;
void validateComponent ( const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
Codec2AudioDecHidlTest : : standardComp compName , bool & disableTest ) {
// Validate its a C2 Component
if ( component - > getName ( ) . find ( " c2 " ) = = std : : string : : npos ) {
ALOGE ( " Not a c2 component " ) ;
@ -241,14 +231,12 @@ void validateComponent(
return ;
}
std : : vector < std : : unique_ptr < C2Param > > queried ;
c2_status_t c2err =
component - > query ( { } , { C2PortMediaTypeSetting : : input : : PARAM_TYPE } ,
C2_DONT_BLOCK , & queried ) ;
c2_status_t c2err = component - > query ( { } , { C2PortMediaTypeSetting : : input : : PARAM_TYPE } ,
C2_DONT_BLOCK , & queried ) ;
if ( c2err ! = C2_OK & & queried . size ( ) = = 0 ) {
ALOGE ( " Query media type failed => %d " , c2err ) ;
} else {
std : : string inputDomain =
( ( C2StreamMediaTypeSetting : : input * ) queried [ 0 ] . get ( ) ) - > m . value ;
std : : string inputDomain = ( ( C2StreamMediaTypeSetting : : input * ) queried [ 0 ] . get ( ) ) - > m . value ;
if ( inputDomain . find ( " audio/ " ) = = std : : string : : npos ) {
ALOGE ( " Expected Audio Component " ) ;
disableTest = true ;
@ -266,16 +254,14 @@ void validateComponent(
}
// Set Default config param.
bool setupConfigParam (
const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
int32_t * bitStreamInfo ) {
bool setupConfigParam ( const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
int32_t * bitStreamInfo ) {
std : : vector < std : : unique_ptr < C2SettingResult > > failures ;
C2StreamSampleRateInfo : : output sampleRateInfo ( 0u , bitStreamInfo [ 0 ] ) ;
C2StreamChannelCountInfo : : output channelCountInfo ( 0u , bitStreamInfo [ 1 ] ) ;
std : : vector < C2Param * > configParam { & sampleRateInfo , & channelCountInfo } ;
c2_status_t status =
component - > config ( configParam , C2_DONT_BLOCK , & failures ) ;
c2_status_t status = component - > config ( configParam , C2_DONT_BLOCK , & failures ) ;
if ( status = = C2_OK & & failures . size ( ) = = 0u ) return true ;
return false ;
}
@ -283,17 +269,15 @@ bool setupConfigParam(
// In decoder components, often the input parameters get updated upon
// parsing the header of elementary stream. Client needs to collect this
// information and reconfigure
void getInputChannelInfo (
const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
Codec2AudioDecHidlTest : : standardComp compName , int32_t * bitStreamInfo ) {
void getInputChannelInfo ( const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
Codec2AudioDecHidlTest : : standardComp compName , int32_t * bitStreamInfo ) {
// query nSampleRate and nChannels
std : : initializer_list < C2Param : : Index > indices {
C2StreamSampleRateInfo : : output : : PARAM_TYPE ,
C2StreamChannelCountInfo : : output : : PARAM_TYPE ,
C2StreamSampleRateInfo : : output : : PARAM_TYPE ,
C2StreamChannelCountInfo : : output : : PARAM_TYPE ,
} ;
std : : vector < std : : unique_ptr < C2Param > > inParams ;
c2_status_t status =
component - > query ( { } , indices , C2_DONT_BLOCK , & inParams ) ;
c2_status_t status = component - > query ( { } , indices , C2_DONT_BLOCK , & inParams ) ;
if ( status ! = C2_OK & & inParams . size ( ) = = 0 ) {
ALOGE ( " Query media type failed => %d " , status ) ;
ASSERT_TRUE ( false ) ;
@ -328,8 +312,8 @@ void getInputChannelInfo(
# define STREAM_COUNT 2
// LookUpTable of clips and metadata for component testing
void GetURLForComponent ( Codec2AudioDecHidlTest : : standardComp comp , char * mURL ,
char * info , size_t streamIndex = 0 ) {
void GetURLForComponent ( Codec2AudioDecHidlTest : : standardComp comp , char * mURL , char * info ,
size_t streamIndex = 0 ) {
struct CompToURL {
Codec2AudioDecHidlTest : : standardComp comp ;
const char mURL [ STREAM_COUNT ] [ 512 ] ;
@ -338,52 +322,47 @@ void GetURLForComponent(Codec2AudioDecHidlTest::standardComp comp, char* mURL,
ASSERT_TRUE ( streamIndex < STREAM_COUNT ) ;
static const CompToURL kCompToURL [ ] = {
{ Codec2AudioDecHidlTest : : standardComp : : xaac ,
{ " bbb_aac_stereo_128kbps_48000hz.aac " ,
" bbb_aac_stereo_128kbps_48000hz.aac " } ,
{ " bbb_aac_stereo_128kbps_48000hz.info " ,
" bbb_aac_stereo_128kbps_48000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : mp3 ,
{ " bbb_mp3_stereo_192kbps_48000hz.mp3 " ,
" bbb_mp3_stereo_192kbps_48000hz.mp3 " } ,
{ " bbb_mp3_stereo_192kbps_48000hz.info " ,
" bbb_mp3_stereo_192kbps_48000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : aac ,
{ " bbb_aac_stereo_128kbps_48000hz.aac " ,
" bbb_aac_stereo_128kbps_48000hz.aac " } ,
{ " bbb_aac_stereo_128kbps_48000hz.info " ,
" bbb_aac_stereo_128kbps_48000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : amrnb ,
{ " sine_amrnb_1ch_12kbps_8000hz.amrnb " ,
" sine_amrnb_1ch_12kbps_8000hz.amrnb " } ,
{ " sine_amrnb_1ch_12kbps_8000hz.info " ,
" sine_amrnb_1ch_12kbps_8000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : amrwb ,
{ " bbb_amrwb_1ch_14kbps_16000hz.amrwb " ,
" bbb_amrwb_1ch_14kbps_16000hz.amrwb " } ,
{ " bbb_amrwb_1ch_14kbps_16000hz.info " ,
" bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : vorbis ,
{ " bbb_vorbis_stereo_128kbps_48000hz.vorbis " , " " } ,
{ " bbb_vorbis_stereo_128kbps_48000hz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : opus ,
{ " bbb_opus_stereo_128kbps_48000hz.opus " , " " } ,
{ " bbb_opus_stereo_128kbps_48000hz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : g711alaw ,
{ " bbb_g711alaw_1ch_8khz.raw " , " " } ,
{ " bbb_g711alaw_1ch_8khz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : g711mlaw ,
{ " bbb_g711mulaw_1ch_8khz.raw " , " " } ,
{ " bbb_g711mulaw_1ch_8khz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : gsm ,
{ " bbb_gsm_1ch_8khz_13kbps.raw " , " " } ,
{ " bbb_gsm_1ch_8khz_13kbps.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : raw ,
{ " bbb_raw_1ch_8khz_s32le.raw " , " " } ,
{ " bbb_raw_1ch_8khz_s32le.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : flac ,
{ " bbb_flac_stereo_680kbps_48000hz.flac " , " " } ,
{ " bbb_flac_stereo_680kbps_48000hz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : xaac ,
{ " bbb_aac_stereo_128kbps_48000hz.aac " , " bbb_aac_stereo_128kbps_48000hz.aac " } ,
{ " bbb_aac_stereo_128kbps_48000hz.info " ,
" bbb_aac_stereo_128kbps_48000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : mp3 ,
{ " bbb_mp3_stereo_192kbps_48000hz.mp3 " , " bbb_mp3_stereo_192kbps_48000hz.mp3 " } ,
{ " bbb_mp3_stereo_192kbps_48000hz.info " ,
" bbb_mp3_stereo_192kbps_48000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : aac ,
{ " bbb_aac_stereo_128kbps_48000hz.aac " , " bbb_aac_stereo_128kbps_48000hz.aac " } ,
{ " bbb_aac_stereo_128kbps_48000hz.info " ,
" bbb_aac_stereo_128kbps_48000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : amrnb ,
{ " sine_amrnb_1ch_12kbps_8000hz.amrnb " , " sine_amrnb_1ch_12kbps_8000hz.amrnb " } ,
{ " sine_amrnb_1ch_12kbps_8000hz.info " ,
" sine_amrnb_1ch_12kbps_8000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : amrwb ,
{ " bbb_amrwb_1ch_14kbps_16000hz.amrwb " , " bbb_amrwb_1ch_14kbps_16000hz.amrwb " } ,
{ " bbb_amrwb_1ch_14kbps_16000hz.info " ,
" bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : vorbis ,
{ " bbb_vorbis_stereo_128kbps_48000hz.vorbis " , " " } ,
{ " bbb_vorbis_stereo_128kbps_48000hz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : opus ,
{ " bbb_opus_stereo_128kbps_48000hz.opus " , " " } ,
{ " bbb_opus_stereo_128kbps_48000hz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : g711alaw ,
{ " bbb_g711alaw_1ch_8khz.raw " , " " } ,
{ " bbb_g711alaw_1ch_8khz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : g711mlaw ,
{ " bbb_g711mulaw_1ch_8khz.raw " , " " } ,
{ " bbb_g711mulaw_1ch_8khz.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : gsm ,
{ " bbb_gsm_1ch_8khz_13kbps.raw " , " " } ,
{ " bbb_gsm_1ch_8khz_13kbps.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : raw ,
{ " bbb_raw_1ch_8khz_s32le.raw " , " " } ,
{ " bbb_raw_1ch_8khz_s32le.info " , " " } } ,
{ Codec2AudioDecHidlTest : : standardComp : : flac ,
{ " bbb_flac_stereo_680kbps_48000hz.flac " , " " } ,
{ " bbb_flac_stereo_680kbps_48000hz.info " , " " } } ,
} ;
for ( size_t i = 0 ; i < sizeof ( kCompToURL ) / sizeof ( kCompToURL [ 0 ] ) ; + + i ) {
@ -396,13 +375,11 @@ void GetURLForComponent(Codec2AudioDecHidlTest::standardComp comp, char* mURL,
}
void decodeNFrames ( const std : : shared_ptr < android : : Codec2Client : : Component > & component ,
std : : mutex & queueLock , std : : condition_variable & queueCondition ,
std : : mutex & queueLock , std : : condition_variable & queueCondition ,
std : : list < std : : unique_ptr < C2Work > > & workQueue ,
std : : list < uint64_t > & flushedIndices ,
std : : shared_ptr < C2BlockPool > & linearPool ,
std : : ifstream & eleStream ,
android : : Vector < FrameInfo > * Info ,
int offset , int range , bool signalEOS = true ) {
std : : list < uint64_t > & flushedIndices , std : : shared_ptr < C2BlockPool > & linearPool ,
std : : ifstream & eleStream , android : : Vector < FrameInfo > * Info , int offset ,
int range , bool signalEOS = true ) {
typedef std : : unique_lock < std : : mutex > ULock ;
int frameID = offset ;
int maxRetry = 0 ;
@ -426,8 +403,7 @@ void decodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp
}
int64_t timestamp = ( * Info ) [ frameID ] . timestamp ;
if ( ( * Info ) [ frameID ] . flags ) flags = 1u < < ( ( * Info ) [ frameID ] . flags - 1 ) ;
if ( signalEOS & & ( ( frameID = = ( int ) Info - > size ( ) - 1 ) | |
( frameID = = ( offset + range - 1 ) ) ) )
if ( signalEOS & & ( ( frameID = = ( int ) Info - > size ( ) - 1 ) | | ( frameID = = ( offset + range - 1 ) ) ) )
flags | = C2FrameData : : FLAG_END_OF_STREAM ;
work - > input . flags = ( C2FrameData : : flags_t ) flags ;
@ -448,9 +424,8 @@ void decodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp
if ( size ) {
std : : shared_ptr < C2LinearBlock > block ;
ASSERT_EQ ( C2_OK ,
linearPool - > fetchLinearBlock (
size , { C2MemoryUsage : : CPU_READ , C2MemoryUsage : : CPU_WRITE } ,
& block ) ) ;
linearPool - > fetchLinearBlock (
size , { C2MemoryUsage : : CPU_READ , C2MemoryUsage : : CPU_WRITE } , & block ) ) ;
ASSERT_TRUE ( block ) ;
// Write View
@ -482,45 +457,49 @@ void decodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp
}
}
TEST_ F ( Codec2AudioDecHidlTest , validateCompName ) {
if ( mDisableTest ) return ;
TEST_ P ( Codec2AudioDecHidlTest , validateCompName ) {
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
ALOGV ( " Checks if the given component is a valid audio component " ) ;
validateComponent ( mComponent , mCompName , mDisableTest ) ;
ASSERT_EQ ( mDisableTest , false ) ;
}
TEST_ F ( Codec2AudioDecHidlTest , configComp ) {
TEST_ P ( Codec2AudioDecHidlTest , configComp ) {
description ( " Tests component specific configuration " ) ;
if ( mDisableTest ) return ;
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
ASSERT_EQ ( mComponent - > start ( ) , C2_OK ) ;
int32_t bitStreamInfo [ 2 ] = { 0 } ;
ASSERT_NO_FATAL_FAILURE (
getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
ASSERT_NO_FATAL_FAILURE ( getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
setupConfigParam ( mComponent , bitStreamInfo ) ;
ASSERT_EQ ( mComponent - > stop ( ) , C2_OK ) ;
}
class Codec2AudioDecDecodeTest
: public Codec2AudioDecHidlTest ,
public : : testing : : WithParamInterface < std : : pair < int32_t , bool > > {
: public Codec2AudioDecHidlTestBase ,
public : : testing : : WithParamInterface <
std : : tuple < std : : string , std : : string , std : : string , std : : string > > {
void getParams ( ) {
mInstanceName = std : : get < 0 > ( GetParam ( ) ) ;
mComponentName = std : : get < 1 > ( GetParam ( ) ) ;
}
} ;
TEST_P ( Codec2AudioDecDecodeTest , DecodeTest ) {
description ( " Decodes input file " ) ;
if ( mDisableTest ) return ;
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
uint32_t streamIndex = GetParam ( ) . first ;
bool signalEOS = GetParam ( ) . second ;
uint32_t streamIndex = std : : stoi ( std : : get < 2 > ( GetParam ( ) ) ) ;
;
bool signalEOS = ! std : : get < 3 > ( GetParam ( ) ) . compare ( " true " ) ;
mTimestampDevTest = true ;
char mURL [ 512 ] , info [ 512 ] ;
std : : ifstream eleStream , eleInfo ;
strcpy ( mURL , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( info , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( mURL , sResourceDir . c_str ( ) ) ;
strcpy ( info , sResourceDir . c_str ( ) ) ;
GetURLForComponent ( mCompName , mURL , info , streamIndex ) ;
if ( ! strcmp ( mURL , gEnv - > getRes ( ) . c_str ( ) ) ) {
ALOGV ( " EMPTY INPUT gEnv->getRes().c_str() %s mURL %s " ,
gEnv - > getRes ( ) . c_str ( ) , mURL ) ;
if ( ! strcmp ( mURL , sResourceDir . c_str ( ) ) ) {
ALOGV ( " EMPTY INPUT sResourceDir.c_str() %s mURL %s " , sResourceDir . c_str ( ) , mURL ) ;
return ;
}
@ -534,10 +513,8 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
if ( ! ( eleInfo > > bytesCount ) ) break ;
eleInfo > > flags ;
eleInfo > > timestamp ;
bool codecConfig =
( ( 1 < < ( flags - 1 ) ) & C2FrameData : : FLAG_CODEC_CONFIG ) ! = 0 ;
if ( mTimestampDevTest & & ! codecConfig )
mTimestampUslist . push_back ( timestamp ) ;
bool codecConfig = ( ( 1 < < ( flags - 1 ) ) & C2FrameData : : FLAG_CODEC_CONFIG ) ! = 0 ;
if ( mTimestampDevTest & & ! codecConfig ) mTimestampUslist . push_back ( timestamp ) ;
Info . push_back ( { bytesCount , flags , timestamp } ) ;
}
eleInfo . close ( ) ;
@ -549,8 +526,7 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
bitStreamInfo [ 0 ] = 8000 ;
bitStreamInfo [ 1 ] = 1 ;
} else {
ASSERT_NO_FATAL_FAILURE (
getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
ASSERT_NO_FATAL_FAILURE ( getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
}
if ( ! setupConfigParam ( mComponent , bitStreamInfo ) ) {
std : : cout < < " [ WARN ] Test Skipped \n " ;
@ -560,29 +536,25 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
ALOGV ( " mURL : %s " , mURL ) ;
eleStream . open ( mURL , std : : ifstream : : binary ) ;
ASSERT_EQ ( eleStream . is_open ( ) , true ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames (
mComponent , mQueueLock , mQueueCondition , mWorkQueue , mFlushedIndices ,
mLinearPool , eleStream , & Info , 0 , ( int ) Info . size ( ) , signalEOS ) ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames ( mComponent , mQueueLock , mQueueCondition , mWorkQueue ,
mFlushedIndices , mLinearPool , eleStream , & Info , 0 ,
( int ) Info . size ( ) , signalEOS ) ) ;
// If EOS is not sent, sending empty input with EOS flag
size_t infoSize = Info . size ( ) ;
if ( ! signalEOS ) {
ASSERT_NO_FATAL_FAILURE (
waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue , 1 ) ) ;
ASSERT_NO_FATAL_FAILURE (
testInputBuffer ( mComponent , mQueueLock , mWorkQueue ,
C2FrameData : : FLAG_END_OF_STREAM , false ) ) ;
ASSERT_NO_FATAL_FAILURE ( waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue , 1 ) ) ;
ASSERT_NO_FATAL_FAILURE ( testInputBuffer ( mComponent , mQueueLock , mWorkQueue ,
C2FrameData : : FLAG_END_OF_STREAM , false ) ) ;
infoSize + = 1 ;
}
// blocking call to ensures application to Wait till all the inputs are
// consumed
ASSERT_NO_FATAL_FAILURE (
waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ) ) ;
ASSERT_NO_FATAL_FAILURE ( waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ) ) ;
eleStream . close ( ) ;
if ( mFramesReceived ! = infoSize ) {
ALOGE ( " Input buffer count and Output buffer count mismatch " ) ;
ALOGE ( " framesReceived : %d inputFrames : %zu " , mFramesReceived ,
infoSize ) ;
ALOGE ( " framesReceived : %d inputFrames : %zu " , mFramesReceived , infoSize ) ;
ASSERT_TRUE ( false ) ;
}
ASSERT_EQ ( mEos , true ) ;
@ -590,8 +562,7 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
uint64_t expTs ;
uint32_t samplesReceived = 0 ;
// Update SampleRate and ChannelCount
ASSERT_NO_FATAL_FAILURE (
getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
ASSERT_NO_FATAL_FAILURE ( getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
int nSampleRate = bitStreamInfo [ 0 ] ;
int nChannels = bitStreamInfo [ 1 ] ;
std : : list < uint64_t > : : iterator itIn = mTimestampUslist . begin ( ) ;
@ -614,23 +585,17 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
}
ASSERT_EQ ( mComponent - > stop ( ) , C2_OK ) ;
}
// DecodeTest with StreamIndex and EOS / No EOS
INSTANTIATE_TEST_CASE_P ( StreamIndexAndEOS , Codec2AudioDecDecodeTest ,
: : testing : : Values ( std : : make_pair ( 0 , false ) ,
std : : make_pair ( 0 , true ) ,
std : : make_pair ( 1 , false ) ,
std : : make_pair ( 1 , true ) ) ) ;
// thumbnail test
TEST_ F ( Codec2AudioDecHidlTest , ThumbnailTest ) {
TEST_P ( Codec2AudioDecHidlTest , ThumbnailTest ) {
description ( " Test Request for thumbnail " ) ;
if ( mDisableTest ) return ;
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
char mURL [ 512 ] , info [ 512 ] ;
std : : ifstream eleStream , eleInfo ;
strcpy ( mURL , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( info , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( mURL , sResourceDir . c_str ( ) ) ;
strcpy ( info , sResourceDir . c_str ( ) ) ;
GetURLForComponent ( mCompName , mURL , info ) ;
eleInfo . open ( info ) ;
@ -651,8 +616,7 @@ TEST_F(Codec2AudioDecHidlTest, ThumbnailTest) {
bitStreamInfo [ 0 ] = 8000 ;
bitStreamInfo [ 1 ] = 1 ;
} else {
ASSERT_NO_FATAL_FAILURE (
getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
ASSERT_NO_FATAL_FAILURE ( getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
}
if ( ! setupConfigParam ( mComponent , bitStreamInfo ) ) {
std : : cout < < " [ WARN ] Test Skipped \n " ;
@ -672,20 +636,19 @@ TEST_F(Codec2AudioDecHidlTest, ThumbnailTest) {
} while ( ! ( flags & SYNC_FRAME ) ) ;
eleStream . open ( mURL , std : : ifstream : : binary ) ;
ASSERT_EQ ( eleStream . is_open ( ) , true ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames (
mComponent , mQueueLock , mQueueCondition , mWorkQueue , mFlushedIndices ,
mLinearPool , eleStream , & Info , 0 , i + 1 ) ) ;
ASSERT_NO_FATAL_FAILURE (
waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ) ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames ( mComponent , mQueueLock , mQueueCondition , mWorkQueue ,
mFlushedIndices , mLinearPool , eleStream , & Info , 0 ,
i + 1 ) ) ;
ASSERT_NO_FATAL_FAILURE ( waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ) ) ;
eleStream . close ( ) ;
EXPECT_GE ( mFramesReceived , 1U ) ;
ASSERT_EQ ( mEos , true ) ;
ASSERT_EQ ( mComponent - > stop ( ) , C2_OK ) ;
}
TEST_ F ( Codec2AudioDecHidlTest , EOSTest ) {
TEST_ P ( Codec2AudioDecHidlTest , EOSTest ) {
description ( " Test empty input buffer with EOS flag " ) ;
if ( mDisableTest ) return ;
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
typedef std : : unique_lock < std : : mutex > ULock ;
ASSERT_EQ ( mComponent - > start ( ) , C2_OK ) ;
std : : unique_ptr < C2Work > work ;
@ -723,15 +686,15 @@ TEST_F(Codec2AudioDecHidlTest, EOSTest) {
ASSERT_EQ ( mComponent - > stop ( ) , C2_OK ) ;
}
TEST_ F ( Codec2AudioDecHidlTest , FlushTest ) {
TEST_ P ( Codec2AudioDecHidlTest , FlushTest ) {
description ( " Tests Flush calls " ) ;
if ( mDisableTest ) return ;
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
typedef std : : unique_lock < std : : mutex > ULock ;
char mURL [ 512 ] , info [ 512 ] ;
std : : ifstream eleStream , eleInfo ;
strcpy ( mURL , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( info , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( mURL , sResourceDir . c_str ( ) ) ;
strcpy ( info , sResourceDir . c_str ( ) ) ;
GetURLForComponent ( mCompName , mURL , info ) ;
eleInfo . open ( info ) ;
@ -753,8 +716,7 @@ TEST_F(Codec2AudioDecHidlTest, FlushTest) {
bitStreamInfo [ 0 ] = 8000 ;
bitStreamInfo [ 1 ] = 1 ;
} else {
ASSERT_NO_FATAL_FAILURE (
getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
ASSERT_NO_FATAL_FAILURE ( getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
}
if ( ! setupConfigParam ( mComponent , bitStreamInfo ) ) {
std : : cout < < " [ WARN ] Test Skipped \n " ;
@ -768,29 +730,25 @@ TEST_F(Codec2AudioDecHidlTest, FlushTest) {
// frame after this so that the below section can be covered for all
// components
uint32_t numFramesFlushed = 128 ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames (
mComponent , mQueueLock , mQueueCondition , mWorkQueue , mFlushedIndices ,
mLinearPool , eleStream , & Info , 0 , numFramesFlushed , false ) ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames ( mComponent , mQueueLock , mQueueCondition , mWorkQueue ,
mFlushedIndices , mLinearPool , eleStream , & Info , 0 ,
numFramesFlushed , false ) ) ;
// flush
std : : list < std : : unique_ptr < C2Work > > flushedWork ;
c2_status_t err =
mComponent - > flush ( C2Component : : FLUSH_COMPONENT , & flushedWork ) ;
c2_status_t err = mComponent - > flush ( C2Component : : FLUSH_COMPONENT , & flushedWork ) ;
ASSERT_EQ ( err , C2_OK ) ;
ASSERT_NO_FATAL_FAILURE (
waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ,
( size_t ) MAX_INPUT_BUFFERS - flushedWork . size ( ) ) ) ;
ASSERT_NO_FATAL_FAILURE ( waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ,
( size_t ) MAX_INPUT_BUFFERS - flushedWork . size ( ) ) ) ;
uint64_t frameIndex ;
{
// Update mFlushedIndices based on the index received from flush()
// Update mFlushedIndices based on the index received from flush()
ULock l ( mQueueLock ) ;
for ( std : : unique_ptr < C2Work > & work : flushedWork ) {
ASSERT_NE ( work , nullptr ) ;
frameIndex = work - > input . ordinal . frameIndex . peeku ( ) ;
std : : list < uint64_t > : : iterator frameIndexIt =
std : : find ( mFlushedIndices . begin ( ) , mFlushedIndices . end ( ) ,
frameIndex ) ;
if ( ! mFlushedIndices . empty ( ) & &
( frameIndexIt ! = mFlushedIndices . end ( ) ) ) {
std : : find ( mFlushedIndices . begin ( ) , mFlushedIndices . end ( ) , frameIndex ) ;
if ( ! mFlushedIndices . empty ( ) & & ( frameIndexIt ! = mFlushedIndices . end ( ) ) ) {
mFlushedIndices . erase ( frameIndexIt ) ;
work - > input . buffers . clear ( ) ;
work - > worklets . clear ( ) ;
@ -814,29 +772,24 @@ TEST_F(Codec2AudioDecHidlTest, FlushTest) {
index + + ;
}
if ( keyFrame ) {
ASSERT_NO_FATAL_FAILURE (
decodeNFrames ( mComponent , mQueueLock , mQueueCondition , mWorkQueue ,
mFlushedIndices , mLinearPool , eleStream , & Info , index ,
( int ) Info . size ( ) - index ) ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames ( mComponent , mQueueLock , mQueueCondition , mWorkQueue ,
mFlushedIndices , mLinearPool , eleStream , & Info , index ,
( int ) Info . size ( ) - index ) ) ;
}
eleStream . close ( ) ;
err =
mComponent - > flush ( C2Component : : FLUSH_COMPONENT , & flushedWork ) ;
err = mComponent - > flush ( C2Component : : FLUSH_COMPONENT , & flushedWork ) ;
ASSERT_EQ ( err , C2_OK ) ;
ASSERT_NO_FATAL_FAILURE (
waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ,
( size_t ) MAX_INPUT_BUFFERS - flushedWork . size ( ) ) ) ;
ASSERT_NO_FATAL_FAILURE ( waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ,
( size_t ) MAX_INPUT_BUFFERS - flushedWork . size ( ) ) ) ;
{
// Update mFlushedIndices based on the index received from flush()
// Update mFlushedIndices based on the index received from flush()
ULock l ( mQueueLock ) ;
for ( std : : unique_ptr < C2Work > & work : flushedWork ) {
ASSERT_NE ( work , nullptr ) ;
frameIndex = work - > input . ordinal . frameIndex . peeku ( ) ;
std : : list < uint64_t > : : iterator frameIndexIt =
std : : find ( mFlushedIndices . begin ( ) , mFlushedIndices . end ( ) ,
frameIndex ) ;
if ( ! mFlushedIndices . empty ( ) & &
( frameIndexIt ! = mFlushedIndices . end ( ) ) ) {
std : : find ( mFlushedIndices . begin ( ) , mFlushedIndices . end ( ) , frameIndex ) ;
if ( ! mFlushedIndices . empty ( ) & & ( frameIndexIt ! = mFlushedIndices . end ( ) ) ) {
mFlushedIndices . erase ( frameIndexIt ) ;
work - > input . buffers . clear ( ) ;
work - > worklets . clear ( ) ;
@ -848,15 +801,15 @@ TEST_F(Codec2AudioDecHidlTest, FlushTest) {
ASSERT_EQ ( mComponent - > stop ( ) , C2_OK ) ;
}
TEST_ F ( Codec2AudioDecHidlTest , DecodeTestEmptyBuffersInserted ) {
TEST_ P ( Codec2AudioDecHidlTest , DecodeTestEmptyBuffersInserted ) {
description ( " Decode with multiple empty input frames " ) ;
if ( mDisableTest ) return ;
if ( mDisableTest ) GTEST_SKIP ( ) < < " Test is disabled " ;
char mURL [ 512 ] , info [ 512 ] ;
std : : ifstream eleStream , eleInfo ;
strcpy ( mURL , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( info , gEnv- > getRes ( ) . c_str ( ) ) ;
strcpy ( mURL , sResourceDir . c_str ( ) ) ;
strcpy ( info , sResourceDir . c_str ( ) ) ;
GetURLForComponent ( mCompName , mURL , info ) ;
eleInfo . open ( info ) ;
@ -871,15 +824,16 @@ TEST_F(Codec2AudioDecHidlTest, DecodeTestEmptyBuffersInserted) {
// and empty input frames at an interval of 5 frames.
while ( 1 ) {
if ( ! ( frameId % 5 ) ) {
if ( ! ( frameId % 20 ) ) flags = 32 ;
else flags = 0 ;
if ( ! ( frameId % 20 ) )
flags = 32 ;
else
flags = 0 ;
bytesCount = 0 ;
} else {
if ( ! ( eleInfo > > bytesCount ) ) break ;
eleInfo > > flags ;
eleInfo > > timestamp ;
codecConfig = flags ?
( ( 1 < < ( flags - 1 ) ) & C2FrameData : : FLAG_CODEC_CONFIG ) ! = 0 : 0 ;
codecConfig = flags ? ( ( 1 < < ( flags - 1 ) ) & C2FrameData : : FLAG_CODEC_CONFIG ) ! = 0 : 0 ;
}
Info . push_back ( { bytesCount , flags , timestamp } ) ;
frameId + + ;
@ -890,8 +844,7 @@ TEST_F(Codec2AudioDecHidlTest, DecodeTestEmptyBuffersInserted) {
bitStreamInfo [ 0 ] = 8000 ;
bitStreamInfo [ 1 ] = 1 ;
} else {
ASSERT_NO_FATAL_FAILURE (
getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
ASSERT_NO_FATAL_FAILURE ( getInputChannelInfo ( mComponent , mCompName , bitStreamInfo ) ) ;
}
if ( ! setupConfigParam ( mComponent , bitStreamInfo ) ) {
std : : cout < < " [ WARN ] Test Skipped \n " ;
@ -901,40 +854,59 @@ TEST_F(Codec2AudioDecHidlTest, DecodeTestEmptyBuffersInserted) {
ALOGV ( " mURL : %s " , mURL ) ;
eleStream . open ( mURL , std : : ifstream : : binary ) ;
ASSERT_EQ ( eleStream . is_open ( ) , true ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames (
mComponent , mQueueLock , mQueueCondition , mWorkQueue , mFlushedIndices ,
mLinearPool , eleStream , & Info , 0 , ( int ) Info . size ( ) ) ) ;
ASSERT_NO_FATAL_FAILURE ( decodeNFrames ( mComponent , mQueueLock , mQueueCondition , mWorkQueue ,
mFlushedIndices , mLinearPool , eleStream , & Info , 0 ,
( int ) Info . size ( ) ) ) ;
// blocking call to ensures application to Wait till all the inputs are
// consumed
if ( ! mEos ) {
ALOGV ( " Waiting for input consumption " ) ;
ASSERT_NO_FATAL_FAILURE (
waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ) ) ;
ASSERT_NO_FATAL_FAILURE ( waitOnInputConsumption ( mQueueLock , mQueueCondition , mWorkQueue ) ) ;
}
eleStream . close ( ) ;
if ( mFramesReceived ! = Info . size ( ) ) {
ALOGE ( " Input buffer count and Output buffer count mismatch " ) ;
ALOGV ( " framesReceived : %d inputFrames : %zu " , mFramesReceived ,
Info . size ( ) ) ;
ALOGV ( " framesReceived : %d inputFrames : %zu " , mFramesReceived , Info . size ( ) ) ;
ASSERT_TRUE ( false ) ;
}
ASSERT_EQ ( mComponent - > stop ( ) , C2_OK ) ;
}
INSTANTIATE_TEST_SUITE_P ( PerInstance , Codec2AudioDecHidlTest , testing : : ValuesIn ( kTestParameters ) ,
android : : hardware : : PrintInstanceTupleNameToString < > ) ;
// DecodeTest with StreamIndex and EOS / No EOS
INSTANTIATE_TEST_SUITE_P ( StreamIndexAndEOS , Codec2AudioDecDecodeTest ,
testing : : ValuesIn ( kDecodeTestParameters ) ,
android : : hardware : : PrintInstanceTupleNameToString < > ) ;
} // anonymous namespace
int main ( int argc , char * * argv ) {
gEnv = new ComponentTestEnvironment ( ) ;
: : testing : : AddGlobalTestEnvironment ( gEnv ) ;
: : testing : : InitGoogleTest ( & argc , argv ) ;
gEnv - > init ( & argc , argv ) ;
int status = gEnv - > initFromOptions ( argc , argv ) ;
if ( status = = 0 ) {
int status = RUN_ALL_TESTS ( ) ;
LOG ( INFO ) < < " C2 Test result = " < < status ;
kTestParameters = getTestParameters ( C2Component : : DOMAIN_AUDIO , C2Component : : KIND_DECODER ) ;
for ( auto params : kTestParameters ) {
kDecodeTestParameters . push_back (
std : : make_tuple ( std : : get < 0 > ( params ) , std : : get < 1 > ( params ) , " 0 " , " false " ) ) ;
kDecodeTestParameters . push_back (
std : : make_tuple ( std : : get < 0 > ( params ) , std : : get < 1 > ( params ) , " 0 " , " true " ) ) ;
kDecodeTestParameters . push_back (
std : : make_tuple ( std : : get < 0 > ( params ) , std : : get < 1 > ( params ) , " 1 " , " false " ) ) ;
kDecodeTestParameters . push_back (
std : : make_tuple ( std : : get < 0 > ( params ) , std : : get < 1 > ( params ) , " 1 " , " true " ) ) ;
}
// Set the resource directory based on command line args.
// Test will fail to set up if the argument is not set.
for ( int i = 1 ; i < argc ; i + + ) {
if ( strcmp ( argv [ i ] , " -P " ) = = 0 & & i < argc - 1 ) {
sResourceDir = argv [ i + 1 ] ;
break ;
}
}
return status ;
}
: : testing : : InitGoogleTest ( & argc , argv ) ;
return RUN_ALL_TESTS ( ) ;
}