Commit 59247b90 authored by Yaowu Xu's avatar Yaowu Xu

ethread_test.cc: replace FramePktHook w/DecompressedFrameHook

This ported changes from libvpx to avoid crash when decoder is not
available.

Change-Id: I853d677ceb1b79354e80c83df34c56e3d5eb0acf
parent 61e7c571
...@@ -27,14 +27,10 @@ class AVxEncoderThreadTest ...@@ -27,14 +27,10 @@ class AVxEncoderThreadTest
: EncoderTest(GET_PARAM(0)), encoder_initialized_(false), tiles_(2), : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), tiles_(2),
encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) { encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) {
init_flags_ = AOM_CODEC_USE_PSNR; init_flags_ = AOM_CODEC_USE_PSNR;
aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t();
cfg.w = 1280;
cfg.h = 720;
decoder_ = codec_->CreateDecoder(cfg, 0);
md5_.clear(); md5_.clear();
} }
virtual ~AVxEncoderThreadTest() { delete decoder_; } virtual ~AVxEncoderThreadTest() {}
virtual void SetUp() { virtual void SetUp() {
InitializeConfig(); InitializeConfig();
...@@ -77,27 +73,27 @@ class AVxEncoderThreadTest ...@@ -77,27 +73,27 @@ class AVxEncoderThreadTest
} }
} }
virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { virtual void DecompressedFrameHook(const aom_image_t &img,
const aom_codec_err_t res = decoder_->DecodeFrame( aom_codec_pts_t /*pts*/) {
reinterpret_cast<uint8_t *>(pkt->data.frame.buf), pkt->data.frame.sz); ::libaom_test::MD5 md5_res;
if (res != AOM_CODEC_OK) { md5_res.Add(&img);
abort_ = true; md5_.push_back(md5_res.Get());
ASSERT_EQ(AOM_CODEC_OK, res); }
}
const aom_image_t *img = decoder_->GetDxData().Next();
if (img) { virtual bool HandleDecodeResult(const aom_codec_err_t res,
::libaom_test::MD5 md5_res; const libaom_test::VideoSource & /*video*/,
md5_res.Add(img); libaom_test::Decoder * /*decoder*/) {
md5_.push_back(md5_res.Get()); if (res != AOM_CODEC_OK) {
EXPECT_EQ(AOM_CODEC_OK, res);
return false;
} }
return true;
} }
bool encoder_initialized_; bool encoder_initialized_;
int tiles_; int tiles_;
::libaom_test::TestMode encoding_mode_; ::libaom_test::TestMode encoding_mode_;
int set_cpu_used_; int set_cpu_used_;
::libaom_test::Decoder *decoder_;
std::vector<std::string> md5_; std::vector<std::string> md5_;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment