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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <limits> 5 #include <limits>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 base::Unretained(&callback))); 55 base::Unretained(&callback)));
56 56
57 height /= 2; 57 height /= 2;
58 capture_data = new CaptureData(planes, SkISize::Make(width, height), 58 capture_data = new CaptureData(planes, SkISize::Make(width, height),
59 media::VideoFrame::RGB32); 59 media::VideoFrame::RGB32);
60 encoder.Encode(capture_data, false, 60 encoder.Encode(capture_data, false,
61 base::Bind(&EncoderCallback::DataAvailable, 61 base::Bind(&EncoderCallback::DataAvailable,
62 base::Unretained(&callback))); 62 base::Unretained(&callback)));
63 } 63 }
64 64
65 class EncoderDpiCallback {
66 public:
67 void DataAvailable(scoped_ptr<VideoPacket> packet) {
68 EXPECT_EQ(packet->dpi(), 96);
69 }
70 };
71
72 // Test that the DPI information is correctly propagated from the CaptureData
73 // to the VideoPacket.
74 TEST(EncoderVp8Test, TestDpiPropagation) {
75 int height = 1;
76 int width = 1;
77 const int kBytesPerPixel = 4;
78
79 EncoderVp8 encoder;
80 EncoderDpiCallback callback;
81
82 std::vector<uint8> buffer(width * height * kBytesPerPixel);
83 DataPlanes planes;
84 planes.data[0] = &buffer.front();
85 planes.strides[0] = width;
86
87 scoped_refptr<CaptureData> capture_data(new CaptureData(
88 planes, SkISize::Make(width, height), media::VideoFrame::RGB32));
89 capture_data->set_dpi(96);
90 encoder.Encode(capture_data, false,
91 base::Bind(&EncoderDpiCallback::DataAvailable,
92 base::Unretained(&callback)));
93 }
94
65 } // namespace remoting 95 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698