ref: 05d533240781daff487a78621b54af77285efd8f
parent: 9d754dcca8d2405fcca283a7c433113ce5765fee
parent: 9e41d569d7c84dd9ca8f0047c15377a883945685
author: Frank Galligan <[email protected]>
date: Tue Dec 17 16:20:34 EST 2013
Merge "Increase required number of external frame buffers"
--- a/test/external_frame_buffer_test.cc
+++ b/test/external_frame_buffer_test.cc
@@ -252,9 +252,10 @@
delete video;
}
-TEST_F(ExternalFrameBufferTest, EightFrameBuffers) {
- // Minimum number of reference buffers for VP9 is 8.
- const int num_buffers = 8;
+TEST_F(ExternalFrameBufferTest, NineFrameBuffers) {
+ // Minimum number of external frame buffers for VP9 is
+ // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS.
+ const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_OK,
SetExternalFrameBuffers(num_buffers, realloc_vp9_frame_buffer));
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
@@ -261,9 +262,11 @@
}
TEST_F(ExternalFrameBufferTest, EightJitterBuffers) {
- // Number of buffers equals number of possible reference buffers(8), plus
- // one working buffer, plus eight jitter buffers.
- const int num_buffers = 17;
+ // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
+ // #VPX_MAXIMUM_WORK_BUFFERS + eight jitter buffers.
+ const int jitter_buffers = 8;
+ const int num_buffers =
+ VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
ASSERT_EQ(VPX_CODEC_OK,
SetExternalFrameBuffers(num_buffers, realloc_vp9_frame_buffer));
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
@@ -270,24 +273,30 @@
}
TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) {
- // Minimum number of reference buffers for VP9 is 8.
- const int num_buffers = 7;
+ // Minimum number of external frame buffers for VP9 is
+ // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS. Set one less.
+ const int num_buffers =
+ VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS - 1;
ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
SetExternalFrameBuffers(num_buffers, realloc_vp9_frame_buffer));
}
TEST_F(ExternalFrameBufferTest, NullFrameBufferList) {
- // Number of buffers equals number of possible reference buffers(8), plus
- // one working buffer, plus four jitter buffers.
- const int num_buffers = 13;
+ // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
+ // #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
+ const int jitter_buffers = 4;
+ const int num_buffers =
+ VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
SetNullFrameBuffers(num_buffers, realloc_vp9_frame_buffer));
}
TEST_F(ExternalFrameBufferTest, NullRealloc) {
- // Number of buffers equals number of possible reference buffers(8), plus
- // one working buffer, plus four jitter buffers.
- const int num_buffers = 13;
+ // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
+ // #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
+ const int jitter_buffers = 4;
+ const int num_buffers =
+ VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
ASSERT_EQ(VPX_CODEC_OK,
SetExternalFrameBuffers(num_buffers,
zero_realloc_vp9_frame_buffer));
@@ -295,9 +304,11 @@
}
TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
- // Number of buffers equals number of possible reference buffers(8), plus
- // one working buffer, plus four jitter buffers.
- const int num_buffers = 13;
+ // Number of buffers equals #VP9_MAXIMUM_REF_BUFFERS +
+ // #VPX_MAXIMUM_WORK_BUFFERS + four jitter buffers.
+ const int jitter_buffers = 4;
+ const int num_buffers =
+ VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
ASSERT_EQ(VPX_CODEC_OK,
SetExternalFrameBuffers(num_buffers,
one_less_byte_realloc_vp9_frame_buffer));
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -508,8 +508,9 @@
vpx_codec_alg_priv_t *ctx,
vpx_codec_frame_buffer_t *fb_list, int fb_count,
vpx_realloc_frame_buffer_cb_fn_t cb, void *user_priv) {
- if (fb_count < REF_FRAMES) {
- /* The application must pass in at least REF_FRAMES frame buffers. */
+ if (fb_count < (VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS)) {
+ /* The application must pass in at least VP9_MAXIMUM_REF_BUFFERS +
+ * VPX_MAXIMUM_WORK_BUFFERS frame buffers. */
return VPX_CODEC_INVALID_PARAM;
} else if (!ctx->pbi) {
/* If the decoder has already been initialized, do not accept external
--- a/vpx/internal/vpx_codec_internal.h
+++ b/vpx/internal/vpx_codec_internal.h
@@ -239,8 +239,8 @@
*
* \note
* When decoding VP9, the application must pass in at least
- * #VP9_MAXIMUM_REF_BUFFERS external frame buffers, as VP9 can have up to
- * that many reference frames.
+ * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
+ * buffers.
*/
typedef vpx_codec_err_t (*vpx_codec_set_frame_buffers_fn_t)(
vpx_codec_alg_priv_t *ctx,
--- a/vpx/vpx_decoder.h
+++ b/vpx/vpx_decoder.h
@@ -363,8 +363,8 @@
*
* \note
* When decoding VP9, the application must pass in at least
- * #VP9_MAXIMUM_REF_BUFFERS external frame buffers, as VP9 can have up to
- * that many reference frames.
+ * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
+ * buffers.
*/
vpx_codec_err_t vpx_codec_set_frame_buffers(
vpx_codec_ctx_t *ctx,