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

Side by Side Diff: ppapi/tests/test_video_encoder.cc

Issue 1132833002: pepper: add software vp9 encoder support to PPB_VideoEncoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tune VP9 parameters Created 5 years, 4 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
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 21 matching lines...) Expand all
32 callback(instance_->pp_instance(), false); 32 callback(instance_->pp_instance(), false);
33 callback.WaitForResult( 33 callback.WaitForResult(
34 video_encoder.GetSupportedProfiles(callback.GetCallback())); 34 video_encoder.GetSupportedProfiles(callback.GetCallback()));
35 35
36 ASSERT_GE(callback.result(), 1U); 36 ASSERT_GE(callback.result(), 1U);
37 37
38 const std::vector<PP_VideoProfileDescription> video_profiles = 38 const std::vector<PP_VideoProfileDescription> video_profiles =
39 callback.output(); 39 callback.output();
40 ASSERT_GE(video_profiles.size(), 1U); 40 ASSERT_GE(video_profiles.size(), 1U);
41 41
42 bool found_vp8 = false; 42 bool found_vp8 = false, found_vp9 = false;
43 for (uint32_t i = 0; i < video_profiles.size(); ++i) { 43 for (uint32_t i = 0; i < video_profiles.size(); ++i) {
44 const PP_VideoProfileDescription& description = video_profiles[i]; 44 const PP_VideoProfileDescription& description = video_profiles[i];
45 if (description.profile == PP_VIDEOPROFILE_VP8_ANY && 45 if (description.hardware_accelerated == PP_FALSE) {
46 description.hardware_accelerated == PP_FALSE) {
47 ASSERT_GE(description.max_framerate_numerator / 46 ASSERT_GE(description.max_framerate_numerator /
48 description.max_framerate_denominator, 47 description.max_framerate_denominator,
49 30U); 48 30U);
50 found_vp8 = true; 49 if (description.profile == PP_VIDEOPROFILE_VP8_ANY)
50 found_vp8 = true;
51 else if (description.profile == PP_VIDEOPROFILE_VP9_ANY)
52 found_vp9 = true;
51 } 53 }
52 } 54 }
53 ASSERT_TRUE(found_vp8); 55 ASSERT_TRUE(found_vp8);
56 ASSERT_TRUE(found_vp9);
54 } 57 }
55 // Test that initializing the encoder with incorrect size fails. 58 // Test that initializing the encoder with incorrect size fails.
56 { 59 {
57 pp::VideoEncoder video_encoder(instance_); 60 pp::VideoEncoder video_encoder(instance_);
58 ASSERT_FALSE(video_encoder.is_null()); 61 ASSERT_FALSE(video_encoder.is_null());
59 pp::Size video_size(0, 0); 62 pp::Size video_size(0, 0);
60 63
61 TestCompletionCallback callback(instance_->pp_instance(), false); 64 TestCompletionCallback callback(instance_->pp_instance(), false);
62 callback.WaitForResult( 65 callback.WaitForResult(
63 video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420, 66 video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420,
(...skipping 29 matching lines...) Expand all
93 96
94 TestCompletionCallbackWithOutput<pp::VideoFrame> get_video_frame( 97 TestCompletionCallbackWithOutput<pp::VideoFrame> get_video_frame(
95 instance_->pp_instance(), false); 98 instance_->pp_instance(), false);
96 get_video_frame.WaitForResult( 99 get_video_frame.WaitForResult(
97 video_encoder.GetVideoFrame(get_video_frame.GetCallback())); 100 video_encoder.GetVideoFrame(get_video_frame.GetCallback()));
98 ASSERT_EQ(PP_OK, get_video_frame.result()); 101 ASSERT_EQ(PP_OK, get_video_frame.result());
99 102
100 pp::Size video_frame_size; 103 pp::Size video_frame_size;
101 ASSERT_TRUE(get_video_frame.output().GetSize(&video_frame_size)); 104 ASSERT_TRUE(get_video_frame.output().GetSize(&video_frame_size));
102 ASSERT_EQ(coded_size.GetArea(), video_frame_size.GetArea()); 105 ASSERT_EQ(coded_size.GetArea(), video_frame_size.GetArea());
103 } 106 }
bbudge 2015/08/05 02:07:45 Can you add a test for VP9? You could macro-ize th
llandwerlin-old 2015/08/05 14:55:17 Done, also split the tests into different function
104 107
105 PASS(); 108 PASS();
106 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698