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

Unified Diff: remoting/base/encoder_vp8_unittest.cc

Issue 10736046: Add DPI information to video packets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use different test values for x and y DPI. Created 8 years, 5 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: remoting/base/encoder_vp8_unittest.cc
diff --git a/remoting/base/encoder_vp8_unittest.cc b/remoting/base/encoder_vp8_unittest.cc
index 0060869cbba75e9c5db0108d9565d36138b46398..3f8bc1f45ae3fcdff181d1755b588842c391492b 100644
--- a/remoting/base/encoder_vp8_unittest.cc
+++ b/remoting/base/encoder_vp8_unittest.cc
@@ -62,4 +62,35 @@ TEST(EncoderVp8Test, TestSizeChangeNoLeak) {
base::Unretained(&callback)));
}
+class EncoderDpiCallback {
+ public:
+ void DataAvailable(scoped_ptr<VideoPacket> packet) {
+ EXPECT_EQ(packet->format().horizontal_dpi(), 96);
+ EXPECT_EQ(packet->format().vertical_dpi(), 97);
+ }
+};
+
+// Test that the DPI information is correctly propagated from the CaptureData
+// to the VideoPacket.
+TEST(EncoderVp8Test, TestDpiPropagation) {
+ int height = 1;
+ int width = 1;
+ const int kBytesPerPixel = 4;
+
+ EncoderVp8 encoder;
+ EncoderDpiCallback callback;
+
+ std::vector<uint8> buffer(width * height * kBytesPerPixel);
+ DataPlanes planes;
+ planes.data[0] = &buffer.front();
+ planes.strides[0] = width;
+
+ scoped_refptr<CaptureData> capture_data(new CaptureData(
+ planes, SkISize::Make(width, height), media::VideoFrame::RGB32));
+ capture_data->set_dpi(SkIPoint::Make(96, 97));
+ encoder.Encode(capture_data, false,
+ base::Bind(&EncoderDpiCallback::DataAvailable,
+ base::Unretained(&callback)));
+}
+
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698