Add external resize tests
Adds a test that ensures the application is able to trigger frame size
changes via vpx_codec_enc_config_set()
Change-Id: I231c062e533d75c8d63c5f8a5544650117429a63
diff --git a/test/video_source.h b/test/video_source.h
index 86c6caa..3507ef0 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -44,8 +44,9 @@
class DummyVideoSource : public VideoSource {
public:
- DummyVideoSource()
- : img_(NULL), limit_(100) { SetSize(80, 64); }
+ DummyVideoSource() : img_(NULL), limit_(100), width_(0), height_(0) {
+ SetSize(80, 64);
+ }
virtual ~DummyVideoSource() { vpx_img_free(img_); }
@@ -76,9 +77,13 @@
virtual unsigned int frame() const { return frame_; }
void SetSize(unsigned int width, unsigned int height) {
- vpx_img_free(img_);
- raw_sz_ = ((width + 31)&~31) * height * 3 / 2;
- img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_VPXI420, width, height, 32);
+ if (width != width_ || height != height_) {
+ vpx_img_free(img_);
+ raw_sz_ = ((width + 31)&~31) * height * 3 / 2;
+ img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_VPXI420, width, height, 32);
+ width_ = width;
+ height_ = height;
+ }
}
protected:
@@ -88,6 +93,8 @@
size_t raw_sz_;
unsigned int limit_;
unsigned int frame_;
+ unsigned int width_;
+ unsigned int height_;
};