Index: media/gpu/video_decode_accelerator_unittest.cc |
diff --git a/media/gpu/video_decode_accelerator_unittest.cc b/media/gpu/video_decode_accelerator_unittest.cc |
index 991394b37ace2c5fa050def69f3da60a6d9f33f3..ab6e6f8c6eccea7e1ef93a1c3ac5bfed92543f12 100644 |
--- a/media/gpu/video_decode_accelerator_unittest.cc |
+++ b/media/gpu/video_decode_accelerator_unittest.cc |
@@ -1527,32 +1527,33 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { |
} |
if (render_as_thumbnails) { |
- std::vector<unsigned char> rgb; |
- bool alpha_solid; |
+ std::vector<unsigned char> rgba; |
base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
base::WaitableEvent::InitialState::NOT_SIGNALED); |
g_env->GetRenderingTaskRunner()->PostTask( |
- FROM_HERE, base::Bind(&RenderingHelper::GetThumbnailsAsRGB, |
- base::Unretained(&rendering_helper_), &rgb, |
- &alpha_solid, &done)); |
+ FROM_HERE, |
+ base::Bind(&RenderingHelper::GetThumbnailsAsRGBA, |
+ base::Unretained(&rendering_helper_), &rgba, &done)); |
done.Wait(); |
+ size_t num_pixels = rgba.size() / 4; |
+ for (size_t i = 0; i < num_pixels; i++) { |
+ EXPECT_EQ(rgba[4 * i + 3], 0xff) << "RGBA frame had incorrect alpha"; |
Owen Lin
2017/06/16 01:24:05
If the values of alpha are wrong, this may leave t
msarett1
2017/06/16 02:11:03
FIxed.
|
+ } |
+ |
std::vector<std::string> golden_md5s; |
std::string md5_string = base::MD5String( |
- base::StringPiece(reinterpret_cast<char*>(&rgb[0]), rgb.size())); |
+ base::StringPiece(reinterpret_cast<char*>(&rgba[0]), rgba.size())); |
Owen Lin
2017/06/15 07:28:05
This will changes the md5 checksum. You need updat
msarett
2017/06/15 18:06:44
Can you help with how to do this? I am able to bu
Owen Lin
2017/06/16 01:24:05
The test data stream and golden md5 golden value a
msarett1
2017/06/16 02:11:03
Ahh yes, that's a much better idea. Done. I thin
|
ReadGoldenThumbnailMD5s(test_video_files_[0].get(), &golden_md5s); |
std::vector<std::string>::iterator match = |
find(golden_md5s.begin(), golden_md5s.end(), md5_string); |
if (match == golden_md5s.end()) { |
- // Convert raw RGB into PNG for export. |
+ // Convert raw RGBA into PNG for export. |
std::vector<unsigned char> png; |
- gfx::PNGCodec::Encode(&rgb[0], |
- gfx::PNGCodec::FORMAT_RGB, |
+ gfx::PNGCodec::Encode(&rgba[0], gfx::PNGCodec::FORMAT_RGBA, |
kThumbnailsPageSize, |
- kThumbnailsPageSize.width() * 3, |
- true, |
- std::vector<gfx::PNGCodec::Comment>(), |
- &png); |
+ kThumbnailsPageSize.width() * 4, true, |
+ std::vector<gfx::PNGCodec::Comment>(), &png); |
LOG(ERROR) << "Unknown thumbnails MD5: " << md5_string; |
@@ -1577,7 +1578,6 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { |
EXPECT_EQ(num_bytes, static_cast<int>(png.size())); |
} |
EXPECT_NE(match, golden_md5s.end()); |
- EXPECT_EQ(alpha_solid, true) << "RGBA frame had incorrect alpha"; |
} |
// Output the frame delivery time to file |