Merge changes If45b8931,Ieab273a7

* changes:
  vp9_ethread_test: avoid crash when decoder is unavailable
  resize_test: skip VP9 decode checks if it's disabled
This commit is contained in:
James Zern
2016-04-27 20:01:33 +00:00
committed by Gerrit Code Review
2 changed files with 14 additions and 0 deletions

View File

@@ -7,6 +7,8 @@
* in the file PATENTS. All contributing project authors may * in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <stdio.h>
#include <climits> #include <climits>
#include <vector> #include <vector>
#include "third_party/googletest/src/include/gtest/gtest.h" #include "third_party/googletest/src/include/gtest/gtest.h"
@@ -558,9 +560,13 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDown) {
} }
} }
#if CONFIG_VP9_DECODER
// Verify that we get 1 resize down event in this test. // Verify that we get 1 resize down event in this test.
ASSERT_EQ(1, resize_count) << "Resizing should occur."; ASSERT_EQ(1, resize_count) << "Resizing should occur.";
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames()); EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
#else
printf("Warning: VP9 decoder unavailable, unable to check resize count!\n");
#endif
} }
// Verify the dynamic resizer behavior for real time, 1 pass CBR mode. // Verify the dynamic resizer behavior for real time, 1 pass CBR mode.
@@ -602,9 +608,13 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
} }
} }
#if CONFIG_VP9_DECODER
// Verify that we get 2 resize events in this test. // Verify that we get 2 resize events in this test.
ASSERT_EQ(resize_count, 2) << "Resizing should occur twice."; ASSERT_EQ(resize_count, 2) << "Resizing should occur twice.";
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames()); EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
#else
printf("Warning: VP9 decoder unavailable, unable to check resize count!\n");
#endif
} }
vpx_img_fmt_t CspForFrameNumber(int frame) { vpx_img_fmt_t CspForFrameNumber(int frame) {

View File

@@ -82,6 +82,7 @@ class VPxEncoderThreadTest
} }
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
#if CONFIG_VP9_DECODER
const vpx_codec_err_t res = decoder_->DecodeFrame( const vpx_codec_err_t res = decoder_->DecodeFrame(
reinterpret_cast<uint8_t*>(pkt->data.frame.buf), pkt->data.frame.sz); reinterpret_cast<uint8_t*>(pkt->data.frame.buf), pkt->data.frame.sz);
if (res != VPX_CODEC_OK) { if (res != VPX_CODEC_OK) {
@@ -95,6 +96,9 @@ class VPxEncoderThreadTest
md5_res.Add(img); md5_res.Add(img);
md5_.push_back(md5_res.Get()); md5_.push_back(md5_res.Get());
} }
#else
ASSERT_EQ(NULL, decoder_);
#endif
} }
bool encoder_initialized_; bool encoder_initialized_;