Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: media/base/video_frame_pool_unittest.cc

Issue 187573006: Allow wrapping a media::VideoFrame with a new view_rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/base/video_frame_pool.cc ('K') | « media/base/video_frame_pool.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_pool_unittest.cc
diff --git a/media/base/video_frame_pool_unittest.cc b/media/base/video_frame_pool_unittest.cc
index 7850e04c4b5e80fb1b40f9ffc78ea93e5e5255e1..268e081b8ace99f5c3e47fbc8d8bd373988a54cb 100644
--- a/media/base/video_frame_pool_unittest.cc
+++ b/media/base/video_frame_pool_unittest.cc
@@ -11,12 +11,20 @@ class VideoFramePoolTest : public ::testing::Test {
public:
VideoFramePoolTest() : pool_(new VideoFramePool()) {}
+
tommi (sloooow) - chröme 2014/03/05 16:17:37 nit: one empty line should be enough
perkj_chrome 2014/03/05 16:39:49 Done.
scoped_refptr<VideoFrame> CreateFrame(VideoFrame::Format format,
int timestamp_ms) {
gfx::Size coded_size(320,240);
gfx::Rect visible_rect(coded_size);
- gfx::Size natural_size(coded_size);
+ return CreateFrame(format, coded_size, visible_rect, timestamp_ms);
+ }
+
+ scoped_refptr<VideoFrame> CreateFrame(VideoFrame::Format format,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect,
+ int timestamp_ms) {
+ gfx::Size natural_size(coded_size);
scoped_refptr<VideoFrame> frame =
pool_->CreateFrame(
format, coded_size, visible_rect, natural_size,
@@ -51,6 +59,23 @@ TEST_F(VideoFramePoolTest, SimpleFrameReuse) {
EXPECT_EQ(old_y_data, new_frame->data(VideoFrame::kYPlane));
}
+TEST_F(VideoFramePoolTest, FrameReuseWithDifferentVisibleRect) {
+ scoped_refptr<VideoFrame> frame = CreateFrame(VideoFrame::YV12, 10);
+ const uint8* old_y_data = frame->data(VideoFrame::kYPlane);
+ const gfx::Size coded_size = frame->coded_size();
+
+ // Clear frame reference to return the frame to the pool.
+ frame = NULL;
+
+ // Verify that the next frame from the pool uses the same memory even if the
+ // visible rect has changed.
+ gfx::Rect visible_rect(5, 5, coded_size.width() - 10,
+ coded_size.height() - 10);
+ scoped_refptr<VideoFrame> new_frame = CreateFrame(
+ VideoFrame::YV12, coded_size, visible_rect, 20);
+ EXPECT_EQ(old_y_data, new_frame->data(VideoFrame::kYPlane));
Ami GONE FROM CHROMIUM 2014/03/05 16:23:42 EXPECT_EQ(new_frame->visible_rect(), visible_rect)
perkj_chrome 2014/03/05 16:39:49 That is done in CreateFrame for all calls to Creat
+}
+
TEST_F(VideoFramePoolTest, SimpleFormatChange) {
scoped_refptr<VideoFrame> frame_a = CreateFrame(VideoFrame::YV12, 10);
scoped_refptr<VideoFrame> frame_b = CreateFrame(VideoFrame::YV12, 10);
« media/base/video_frame_pool.cc ('K') | « media/base/video_frame_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698