Add a test for the interaction between active map and cyclic referesh.
Fails with Icac63051bf37c7355e661837b57c257d58c764fc reverted.
Change-Id: I460d7a5a74faa4daace25f911f8dc5f68e16c951
diff --git a/test/y4m_video_source.h b/test/y4m_video_source.h
index 378e75b..03d9388 100644
--- a/test/y4m_video_source.h
+++ b/test/y4m_video_source.h
@@ -9,6 +9,7 @@
*/
#ifndef TEST_Y4M_VIDEO_SOURCE_H_
#define TEST_Y4M_VIDEO_SOURCE_H_
+#include <algorithm>
#include <string>
#include "test/video_source.h"
@@ -91,6 +92,18 @@
y4m_input_fetch_frame(&y4m_, input_file_, img_.get());
}
+ // Swap buffers with another y4m source. This allows reading a new frame
+ // while keeping the old frame around. A whole Y4mSource is required and
+ // not just a vpx_image_t because of how the y4m reader manipulates
+ // vpx_image_t internals,
+ void SwapBuffers(Y4mVideoSource *other) {
+ std::swap(other->y4m_.dst_buf, y4m_.dst_buf);
+ vpx_image_t *tmp;
+ tmp = other->img_.release();
+ other->img_.reset(img_.release());
+ img_.reset(tmp);
+ }
+
protected:
void CloseSource() {
y4m_input_close(&y4m_);