Showing the changes to test/api/decode_encode_test.cpp (1 of 5 files). Show all
Unified · Split
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | #include "utils/InputStream.h" | 5 | #include "utils/InputStream.h" |
| 6 | #include "BaseDecoderTest.h" | 6 | #include "BaseDecoderTest.h" |
| 7 | #include "BaseEncoderTest.h" | 7 | #include "BaseEncoderTest.h" |
| 8 | 8 | #include <string> | |
| 9 | static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) { | 9 | static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) { |
| 10 | for (int i = 0; i < info.iLayerNum; ++i) { | 10 | for (int i = 0; i < info.iLayerNum; ++i) { |
| 11 | const SLayerBSInfo& layerInfo = info.sLayerInfo[i]; | 11 | const SLayerBSInfo& layerInfo = info.sLayerInfo[i]; |
| @@ -93,8 +93,12 @@ class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>, · 81 unmodified lines | |||
| 93 | 93 | ||
| 94 | TEST_P (DecodeEncodeTest, CompareOutput) { | 94 | TEST_P (DecodeEncodeTest, CompareOutput) { |
| 95 | DecodeEncodeFileParam p = GetParam(); | 95 | DecodeEncodeFileParam p = GetParam(); |
| 96 | 96 | #if defined(ANDROID_NDK) | |
| 97 | std::string filename = std::string ("/sdcard/") + p.fileName; | ||
| 98 | ASSERT_TRUE (Open (filename.c_str())); | ||
| 99 | #else | ||
| 97 | ASSERT_TRUE (Open (p.fileName)); | 100 | ASSERT_TRUE (Open (p.fileName)); |
| 101 | #endif | ||
| 98 | EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this); | 102 | EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this); |
| 99 | unsigned char digest[SHA_DIGEST_LENGTH]; | 103 | unsigned char digest[SHA_DIGEST_LENGTH]; |
| 100 | SHA1Result (&ctx_, digest); | 104 | SHA1Result (&ctx_, digest); |
| @@ -102,18 +106,11 @@ TEST_P (DecodeEncodeTest, CompareOutput) { · 1 unmodified line | |||
| 102 | CompareHash (digest, p.hashStr); | 106 | CompareHash (digest, p.hashStr); |
| 103 | } | 107 | } |
| 104 | } | 108 | } |
| 105 | #if defined(ANDROID_NDK) | ||
| 106 | static const DecodeEncodeFileParam kFileParamArray[] = { | ||
| 107 | {"/sdcard/res/test_vd_1d.264", "a4c7299ec1a7bacd5819685e221a79ac2b56cdbc", 320, 192, 12.0f}, | ||
| 108 | {"/sdcard/res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f}, | ||
| 109 | }; | ||
| 110 | #else | ||
| 111 | static const DecodeEncodeFileParam kFileParamArray[] = { | 109 | static const DecodeEncodeFileParam kFileParamArray[] = { |
| 112 | {"res/test_vd_1d.264", "a4c7299ec1a7bacd5819685e221a79ac2b56cdbc", 320, 192, 12.0f}, | 110 | {"res/test_vd_1d.264", "a4c7299ec1a7bacd5819685e221a79ac2b56cdbc", 320, 192, 12.0f}, |
| 113 | {"res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f}, | 111 | {"res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f}, |
| 114 | }; | 112 | }; |
| 115 | 113 | ||
| 116 | #endif | ||
| 117 | 114 | ||
| 118 | INSTANTIATE_TEST_CASE_P (DecodeEncodeFile, DecodeEncodeTest, | 115 | INSTANTIATE_TEST_CASE_P (DecodeEncodeFile, DecodeEncodeTest, |
| 119 | ::testing::ValuesIn (kFileParamArray)); | 116 | ::testing::ValuesIn (kFileParamArray)); |