OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "third_party/googletest/src/include/gtest/gtest.h" | 10 #include "third_party/googletest/src/include/gtest/gtest.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0)); | 50 vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0)); |
51 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, | 51 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, |
52 vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0)); | 52 vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0)); |
53 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, | 53 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, |
54 vpx_codec_decode(&dec, buf, 0, NULL, 0)); | 54 vpx_codec_decode(&dec, buf, 0, NULL, 0)); |
55 | 55 |
56 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); | 56 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 #if CONFIG_VP8_DECODER | |
61 TEST(DecodeAPI, OptionalParams) { | |
62 vpx_codec_ctx_t dec; | |
63 | |
64 #if CONFIG_ERROR_CONCEALMENT | |
65 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL, | |
66 VPX_CODEC_USE_ERROR_CONCEALMENT)); | |
67 #else | |
68 EXPECT_EQ(VPX_CODEC_INCAPABLE, | |
69 vpx_codec_dec_init(&dec, &vpx_codec_vp8_dx_algo, NULL, | |
70 VPX_CODEC_USE_ERROR_CONCEALMENT)); | |
71 #endif // CONFIG_ERROR_CONCEALMENT | |
72 } | |
73 #endif // CONFIG_VP8_DECODER | |
74 | |
75 #if CONFIG_VP9_DECODER | 60 #if CONFIG_VP9_DECODER |
76 // Test VP9 codec controls after a decode error to ensure the code doesn't | 61 // Test VP9 codec controls after a decode error to ensure the code doesn't |
77 // misbehave. | 62 // misbehave. |
78 void TestVp9Controls(vpx_codec_ctx_t *dec) { | 63 void TestVp9Controls(vpx_codec_ctx_t *dec) { |
79 static const int kControls[] = { | 64 static const int kControls[] = { |
80 VP8D_GET_LAST_REF_UPDATES, | 65 VP8D_GET_LAST_REF_UPDATES, |
81 VP8D_GET_FRAME_CORRUPTED, | 66 VP8D_GET_FRAME_CORRUPTED, |
82 VP9D_GET_DISPLAY_SIZE, | 67 VP9D_GET_DISPLAY_SIZE, |
83 }; | 68 }; |
84 int val[2]; | 69 int val[2]; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0)); | 117 vpx_codec_decode(&dec, video.cxdata(), frame_size, NULL, 0)); |
133 vpx_codec_iter_t iter = NULL; | 118 vpx_codec_iter_t iter = NULL; |
134 EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter)); | 119 EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter)); |
135 | 120 |
136 TestVp9Controls(&dec); | 121 TestVp9Controls(&dec); |
137 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); | 122 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); |
138 } | 123 } |
139 #endif // CONFIG_VP9_DECODER | 124 #endif // CONFIG_VP9_DECODER |
140 | 125 |
141 } // namespace | 126 } // namespace |
OLD | NEW |