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

Unified Diff: media/gpu/video_decode_accelerator_unittest.cc

Issue 2943433002: Revert of Remove FORMAT_RGB from gfx::PngCodec (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « media/gpu/rendering_helper.cc ('k') | ui/gfx/codec/png_codec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ab6e6f8c6eccea7e1ef93a1c3ac5bfed92543f12..991394b37ace2c5fa050def69f3da60a6d9f33f3 100644
--- a/media/gpu/video_decode_accelerator_unittest.cc
+++ b/media/gpu/video_decode_accelerator_unittest.cc
@@ -1527,33 +1527,32 @@
}
if (render_as_thumbnails) {
- std::vector<unsigned char> rgba;
+ std::vector<unsigned char> rgb;
+ bool alpha_solid;
base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
g_env->GetRenderingTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&RenderingHelper::GetThumbnailsAsRGBA,
- base::Unretained(&rendering_helper_), &rgba, &done));
+ FROM_HERE, base::Bind(&RenderingHelper::GetThumbnailsAsRGB,
+ base::Unretained(&rendering_helper_), &rgb,
+ &alpha_solid, &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";
- }
std::vector<std::string> golden_md5s;
std::string md5_string = base::MD5String(
- base::StringPiece(reinterpret_cast<char*>(&rgba[0]), rgba.size()));
+ base::StringPiece(reinterpret_cast<char*>(&rgb[0]), rgb.size()));
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 RGBA into PNG for export.
+ // Convert raw RGB into PNG for export.
std::vector<unsigned char> png;
- gfx::PNGCodec::Encode(&rgba[0], gfx::PNGCodec::FORMAT_RGBA,
+ gfx::PNGCodec::Encode(&rgb[0],
+ gfx::PNGCodec::FORMAT_RGB,
kThumbnailsPageSize,
- kThumbnailsPageSize.width() * 4, true,
- std::vector<gfx::PNGCodec::Comment>(), &png);
+ kThumbnailsPageSize.width() * 3,
+ true,
+ std::vector<gfx::PNGCodec::Comment>(),
+ &png);
LOG(ERROR) << "Unknown thumbnails MD5: " << md5_string;
@@ -1578,6 +1577,7 @@
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
« no previous file with comments | « media/gpu/rendering_helper.cc ('k') | ui/gfx/codec/png_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698