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

Unified Diff: ppapi/tests/test_video_encoder.cc

Issue 956893002: content: pepper: VideoEncoder: add software encoder support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: ppapi/tests/test_video_encoder.cc
diff --git a/ppapi/tests/test_video_encoder.cc b/ppapi/tests/test_video_encoder.cc
index 4737ed0fc72b037545ee7dbe121ff86bbd7ae39f..fe4507f8121522f8317cbcd707c3a4829bb7c20b 100644
--- a/ppapi/tests/test_video_encoder.cc
+++ b/ppapi/tests/test_video_encoder.cc
@@ -32,10 +32,56 @@ std::string TestVideoEncoder::TestCreate() {
callback.WaitForResult(
video_encoder.GetSupportedProfiles(callback.GetCallback()));
- ASSERT_GE(callback.output().size(), 0U);
+ ASSERT_EQ(PP_OK, callback.result());
+ ASSERT_GE(callback.output().size(), 1U);
+
+ bool found_vp8 = false;
+ for (uint32_t i = 0; i < callback.output().size(); ++i) {
+ const PP_VideoProfileDescription& description = callback.output()[i];
+ if (description.profile == PP_VIDEOPROFILE_VP8_ANY)
+ found_vp8 = true;
+ }
+ ASSERT_TRUE(found_vp8);
+ }
+ // Test that initializing the encoder with incorrect size fails.
+ {
+ pp::VideoEncoder video_encoder(instance_);
+ ASSERT_FALSE(video_encoder.is_null());
+ pp::Size video_size(0, 0);
+
+ TestCompletionCallback callback(instance_->pp_instance(), false);
+ callback.WaitForResult(
+ video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420,
+ video_size,
+ PP_VIDEOPROFILE_VP8_ANY,
+ 1000000,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ callback.GetCallback()));
+
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
+ }
+ // Test that initializing the encoder with software VP8 succeeds.
+ {
+ pp::VideoEncoder video_encoder(instance_);
+ ASSERT_FALSE(video_encoder.is_null());
+ pp::Size video_size(640, 480);
+
+ TestCompletionCallback callback(instance_->pp_instance(), false);
+ callback.WaitForResult(
+ video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420,
+ video_size,
+ PP_VIDEOPROFILE_VP8_ANY,
+ 1000000,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ callback.GetCallback()));
+
+ ASSERT_EQ(PP_OK, callback.result());
+
+ pp::Size coded_size;
+ ASSERT_EQ(PP_OK, video_encoder.GetFrameCodedSize(&coded_size));
+ ASSERT_GE(coded_size.GetArea(), video_size.GetArea());
+ ASSERT_GE(video_encoder.GetFramesRequired(), 1);
}
- // TODO(llandwerlin): add more tests once software video encode is
- // available.
PASS();
}

Powered by Google App Engine
This is Rietveld 408576698