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 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // external frame buffer. Returns < 0 on an error. | 64 // external frame buffer. Returns < 0 on an error. |
65 int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { | 65 int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { |
66 EXPECT_TRUE(fb != NULL); | 66 EXPECT_TRUE(fb != NULL); |
67 const int idx = FindFreeBufferIndex(); | 67 const int idx = FindFreeBufferIndex(); |
68 if (idx == num_buffers_) | 68 if (idx == num_buffers_) |
69 return -1; | 69 return -1; |
70 | 70 |
71 if (ext_fb_list_[idx].size < min_size) { | 71 if (ext_fb_list_[idx].size < min_size) { |
72 delete [] ext_fb_list_[idx].data; | 72 delete [] ext_fb_list_[idx].data; |
73 ext_fb_list_[idx].data = new uint8_t[min_size]; | 73 ext_fb_list_[idx].data = new uint8_t[min_size]; |
| 74 memset(ext_fb_list_[idx].data, 0, min_size); |
74 ext_fb_list_[idx].size = min_size; | 75 ext_fb_list_[idx].size = min_size; |
75 } | 76 } |
76 | 77 |
77 SetFrameBuffer(idx, fb); | 78 SetFrameBuffer(idx, fb); |
78 return 0; | 79 return 0; |
79 } | 80 } |
80 | 81 |
81 // Test function that will not allocate any data for the frame buffer. | 82 // Test function that will not allocate any data for the frame buffer. |
82 // Returns < 0 on an error. | 83 // Returns < 0 on an error. |
83 int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { | 84 int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 SetFrameBufferFunctions( | 473 SetFrameBufferFunctions( |
473 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); | 474 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); |
474 } | 475 } |
475 #endif // CONFIG_WEBM_IO | 476 #endif // CONFIG_WEBM_IO |
476 | 477 |
477 VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, | 478 VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, |
478 ::testing::ValuesIn(libvpx_test::kVP9TestVectors, | 479 ::testing::ValuesIn(libvpx_test::kVP9TestVectors, |
479 libvpx_test::kVP9TestVectors + | 480 libvpx_test::kVP9TestVectors + |
480 libvpx_test::kNumVP9TestVectors)); | 481 libvpx_test::kNumVP9TestVectors)); |
481 } // namespace | 482 } // namespace |
OLD | NEW |