| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (ext_fb_list_[idx].size < min_size) { | 90 if (ext_fb_list_[idx].size < min_size) { |
| 91 delete [] ext_fb_list_[idx].data; | 91 delete [] ext_fb_list_[idx].data; |
| 92 ext_fb_list_[idx].data = NULL; | 92 ext_fb_list_[idx].data = NULL; |
| 93 ext_fb_list_[idx].size = min_size; | 93 ext_fb_list_[idx].size = min_size; |
| 94 } | 94 } |
| 95 | 95 |
| 96 SetFrameBuffer(idx, fb); | 96 SetFrameBuffer(idx, fb); |
| 97 return 0; | 97 return 0; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Marks the external frame buffer that |fb| is pointing too as free. | 100 // Marks the external frame buffer that |fb| is pointing to as free. |
| 101 // Returns < 0 on an error. | 101 // Returns < 0 on an error. |
| 102 int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) { | 102 int ReturnFrameBuffer(vpx_codec_frame_buffer_t *fb) { |
| 103 EXPECT_TRUE(fb != NULL); | 103 if (fb == NULL) { |
| 104 EXPECT_TRUE(fb != NULL); |
| 105 return -1; |
| 106 } |
| 104 ExternalFrameBuffer *const ext_fb = | 107 ExternalFrameBuffer *const ext_fb = |
| 105 reinterpret_cast<ExternalFrameBuffer*>(fb->priv); | 108 reinterpret_cast<ExternalFrameBuffer*>(fb->priv); |
| 106 EXPECT_TRUE(ext_fb != NULL); | 109 if (ext_fb == NULL) { |
| 110 EXPECT_TRUE(ext_fb != NULL); |
| 111 return -1; |
| 112 } |
| 107 EXPECT_EQ(1, ext_fb->in_use); | 113 EXPECT_EQ(1, ext_fb->in_use); |
| 108 ext_fb->in_use = 0; | 114 ext_fb->in_use = 0; |
| 109 return 0; | 115 return 0; |
| 110 } | 116 } |
| 111 | 117 |
| 112 // Checks that the ximage data is contained within the external frame buffer | 118 // Checks that the ximage data is contained within the external frame buffer |
| 113 // private data passed back in the ximage. | 119 // private data passed back in the ximage. |
| 114 void CheckXImageFrameBuffer(const vpx_image_t *img) { | 120 void CheckXImageFrameBuffer(const vpx_image_t *img) { |
| 115 if (img->fb_priv != NULL) { | 121 if (img->fb_priv != NULL) { |
| 116 const struct ExternalFrameBuffer *const ext_fb = | 122 const struct ExternalFrameBuffer *const ext_fb = |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 SetFrameBufferFunctions( | 479 SetFrameBufferFunctions( |
| 474 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); | 480 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); |
| 475 } | 481 } |
| 476 #endif // CONFIG_WEBM_IO | 482 #endif // CONFIG_WEBM_IO |
| 477 | 483 |
| 478 VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, | 484 VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, |
| 479 ::testing::ValuesIn(libvpx_test::kVP9TestVectors, | 485 ::testing::ValuesIn(libvpx_test::kVP9TestVectors, |
| 480 libvpx_test::kVP9TestVectors + | 486 libvpx_test::kVP9TestVectors + |
| 481 libvpx_test::kNumVP9TestVectors)); | 487 libvpx_test::kNumVP9TestVectors)); |
| 482 } // namespace | 488 } // namespace |
| OLD | NEW |