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

Side by Side 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: Another android dep fix Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « ppapi/proxy/video_encoder_resource.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/tests/test_video_encoder.h" 5 #include "ppapi/tests/test_video_encoder.h"
6 6
7 #include "ppapi/c/pp_codecs.h" 7 #include "ppapi/c/pp_codecs.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/cpp/video_encoder.h" 9 #include "ppapi/cpp/video_encoder.h"
10 #include "ppapi/tests/testing_instance.h" 10 #include "ppapi/tests/testing_instance.h"
(...skipping 14 matching lines...) Expand all
25 // Test that we get results for supported formats. 25 // Test that we get results for supported formats.
26 { 26 {
27 pp::VideoEncoder video_encoder(instance_); 27 pp::VideoEncoder video_encoder(instance_);
28 ASSERT_FALSE(video_encoder.is_null()); 28 ASSERT_FALSE(video_encoder.is_null());
29 29
30 TestCompletionCallbackWithOutput<std::vector<PP_VideoProfileDescription> > 30 TestCompletionCallbackWithOutput<std::vector<PP_VideoProfileDescription> >
31 callback(instance_->pp_instance(), false); 31 callback(instance_->pp_instance(), false);
32 callback.WaitForResult( 32 callback.WaitForResult(
33 video_encoder.GetSupportedProfiles(callback.GetCallback())); 33 video_encoder.GetSupportedProfiles(callback.GetCallback()));
34 34
35 ASSERT_GE(callback.output().size(), 0U); 35 ASSERT_EQ(PP_OK, callback.result());
36
37 const std::vector<PP_VideoProfileDescription> video_profiles =
38 callback.output();
39 ASSERT_GE(video_profiles.size(), 1U);
40
41 bool found_vp8 = false;
42 for (uint32_t i = 0; i < video_profiles.size(); ++i) {
43 const PP_VideoProfileDescription& description = video_profiles[i];
44 if (description.profile == PP_VIDEOPROFILE_VP8_ANY)
45 found_vp8 = true;
46 }
47 ASSERT_TRUE(found_vp8);
36 } 48 }
37 // TODO(llandwerlin): add more tests once software video encode is 49 // Test that initializing the encoder with incorrect size fails.
38 // available. 50 {
51 pp::VideoEncoder video_encoder(instance_);
52 ASSERT_FALSE(video_encoder.is_null());
53 pp::Size video_size(0, 0);
54
55 TestCompletionCallback callback(instance_->pp_instance(), false);
56 callback.WaitForResult(
57 video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420,
58 video_size,
59 PP_VIDEOPROFILE_VP8_ANY,
60 1000000,
61 PP_HARDWAREACCELERATION_WITHFALLBACK,
62 callback.GetCallback()));
63
64 ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
65 }
66 // Test that initializing the encoder with software VP8 succeeds.
67 {
68 pp::VideoEncoder video_encoder(instance_);
69 ASSERT_FALSE(video_encoder.is_null());
70 pp::Size video_size(640, 480);
71
72 TestCompletionCallback callback(instance_->pp_instance(), false);
73 callback.WaitForResult(
74 video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420,
75 video_size,
76 PP_VIDEOPROFILE_VP8_ANY,
77 1000000,
78 PP_HARDWAREACCELERATION_WITHFALLBACK,
79 callback.GetCallback()));
80
81 ASSERT_EQ(PP_OK, callback.result());
82
83 pp::Size coded_size;
84 ASSERT_EQ(PP_OK, video_encoder.GetFrameCodedSize(&coded_size));
85 ASSERT_GE(coded_size.GetArea(), video_size.GetArea());
86 ASSERT_GE(video_encoder.GetFramesRequired(), 1);
87 }
39 88
40 PASS(); 89 PASS();
41 } 90 }
OLDNEW
« no previous file with comments | « ppapi/proxy/video_encoder_resource.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698