History

fix for in-middle changing simulcast avc setting

Sijia Chen committed 11 years ago

Commit bc1b28b1 parent 09518da4 files · +100 −70Browse files

Showing the changes to test/api/encode_decode_api_test.cpp (1 of 4 files). Show all

Unified · Split

test/api/encode_decode_api_test.cpp+14−14
@@ -3030,8 +3030,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING3) { · 3029 unmodified lines
30303030
30313031
30323032 TEST_F (EncodeDecodeTestAPI, SimulcastSVC) {
3033−#define LAYER_NUM (4)
3034− int iSpatialLayerNum = WelsClip3 ((rand() % LAYER_NUM), 2, LAYER_NUM);
3033+ int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM);
30353034 int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH);
30363035 int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT);
30373036 float fFrameRate = rand() + 0.5f;
@@ -3043,12 +3042,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { · 5 unmodified lines
30433042 int rv = encoder_->InitializeExt (&param_);
30443043 ASSERT_TRUE (rv == cmResultSuccess);
30453044
3046− unsigned char* pBsBuf[LAYER_NUM];
3047− int aLen[LAYER_NUM] = {0};
3048− ISVCDecoder* decoder[LAYER_NUM];
3045+ unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
3046+ int aLen[MAX_SPATIAL_LAYER_NUM] = {0};
3047+ ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM];
30493048
30503049 #ifdef DEBUG_FILE_SAVE2
3051− FILE* fEnc[LAYER_NUM] = { NULL };
3050+ FILE* fEnc[MAX_SPATIAL_LAYER_NUM] = { NULL };
30523051 fEnc[0] = fopen ("enc0.264", "wb");
30533052 fEnc[1] = fopen ("enc1.264", "wb");
30543053 fEnc[2] = fopen ("enc2.264", "wb");
@@ -3059,11 +3058,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { · 4 unmodified lines
30593058 int iIdx = 0;
30603059 for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
30613060 pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2));
3061+ EXPECT_TRUE (pBsBuf[iIdx] != NULL);
30623062 aLen[iIdx] = 0;
30633063
30643064 long rv = WelsCreateDecoder (&decoder[iIdx]);
30653065 ASSERT_EQ (0, rv);
3066− ASSERT_TRUE (decoder[iIdx] != NULL);
3066+ EXPECT_TRUE (decoder[iIdx] != NULL);
30673067
30683068 SDecodingParam decParam;
30693069 memset (&decParam, 0, sizeof (SDecodingParam));
@@ -3144,8 +3144,7 @@ TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { · 74 unmodified lines
31443144
31453145 TEST_F (EncodeDecodeTestAPI, SimulcastAVC) {
31463146 //#define DEBUG_FILE_SAVE3
3147−#define LAYER_NUM (4)
3148− int iSpatialLayerNum = WelsClip3 ((rand() % LAYER_NUM), 2, LAYER_NUM);
3147+ int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM);
31493148 int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH);
31503149 int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT);
31513150 float fFrameRate = rand() + 0.5f;
@@ -3160,12 +3159,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVC) { · 8 unmodified lines
31603159 int rv = encoder_->InitializeExt (&param_);
31613160 ASSERT_TRUE (rv == cmResultSuccess);
31623161
3163− unsigned char* pBsBuf[LAYER_NUM];
3164− int aLen[LAYER_NUM] = {0};
3165− ISVCDecoder* decoder[LAYER_NUM];
3162+ unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
3163+ int aLen[MAX_SPATIAL_LAYER_NUM] = {0};
3164+ ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM];
31663165
31673166 #ifdef DEBUG_FILE_SAVE3
3168− FILE* fEnc[LAYER_NUM];
3167+ FILE* fEnc[MAX_SPATIAL_LAYER_NUM];
31693168 fEnc[0] = fopen ("enc0.264", "wb");
31703169 fEnc[1] = fopen ("enc1.264", "wb");
31713170 fEnc[2] = fopen ("enc2.264", "wb");
@@ -3177,11 +3176,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVC) { · 5 unmodified lines
31773176 //create decoder
31783177 for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
31793178 pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2));
3179+ EXPECT_TRUE (pBsBuf[iIdx] != NULL);
31803180 aLen[iIdx] = 0;
31813181
31823182 long rv = WelsCreateDecoder (&decoder[iIdx]);
31833183 ASSERT_EQ (0, rv);
3184− ASSERT_TRUE (decoder[iIdx] != NULL);
3184+ EXPECT_TRUE (decoder[iIdx] != NULL);
31853185
31863186 SDecodingParam decParam;
31873187 memset (&decParam, 0, sizeof (SDecodingParam));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t