OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 namespace libvpx_test { | 44 namespace libvpx_test { |
45 | 45 |
46 TEST(TestDecrypt, DecryptWorksVp8) { | 46 TEST(TestDecrypt, DecryptWorksVp8) { |
47 libvpx_test::IVFVideoSource video("vp80-00-comprehensive-001.ivf"); | 47 libvpx_test::IVFVideoSource video("vp80-00-comprehensive-001.ivf"); |
48 video.Init(); | 48 video.Init(); |
49 | 49 |
50 vpx_codec_dec_cfg_t dec_cfg = {0}; | 50 vpx_codec_dec_cfg_t dec_cfg = vpx_codec_dec_cfg_t(); |
51 VP8Decoder decoder(dec_cfg, 0); | 51 VP8Decoder decoder(dec_cfg, 0); |
52 | 52 |
53 video.Begin(); | 53 video.Begin(); |
54 | 54 |
55 // no decryption | 55 // no decryption |
56 vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size()); | 56 vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size()); |
57 ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); | 57 ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); |
58 | 58 |
59 // decrypt frame | 59 // decrypt frame |
60 video.Next(); | 60 video.Next(); |
61 | 61 |
62 std::vector<uint8_t> encrypted(video.frame_size()); | 62 std::vector<uint8_t> encrypted(video.frame_size()); |
63 encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0); | 63 encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0); |
64 vpx_decrypt_init di = { test_decrypt_cb, &encrypted[0] }; | 64 vpx_decrypt_init di = { test_decrypt_cb, &encrypted[0] }; |
65 decoder.Control(VPXD_SET_DECRYPTOR, &di); | 65 decoder.Control(VPXD_SET_DECRYPTOR, &di); |
66 | 66 |
67 res = decoder.DecodeFrame(&encrypted[0], encrypted.size()); | 67 res = decoder.DecodeFrame(&encrypted[0], encrypted.size()); |
68 ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); | 68 ASSERT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); |
69 } | 69 } |
70 | 70 |
71 } // namespace libvpx_test | 71 } // namespace libvpx_test |
OLD | NEW |