| OLD | NEW |
| 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 Loading... |
| 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->format().horizontal_dpi(), 96); |
| 69 EXPECT_EQ(packet->format().vertical_dpi(), 97); |
| 70 } |
| 71 }; |
| 72 |
| 73 // Test that the DPI information is correctly propagated from the CaptureData |
| 74 // to the VideoPacket. |
| 75 TEST(EncoderVp8Test, TestDpiPropagation) { |
| 76 int height = 1; |
| 77 int width = 1; |
| 78 const int kBytesPerPixel = 4; |
| 79 |
| 80 EncoderVp8 encoder; |
| 81 EncoderDpiCallback callback; |
| 82 |
| 83 std::vector<uint8> buffer(width * height * kBytesPerPixel); |
| 84 DataPlanes planes; |
| 85 planes.data[0] = &buffer.front(); |
| 86 planes.strides[0] = width; |
| 87 |
| 88 scoped_refptr<CaptureData> capture_data(new CaptureData( |
| 89 planes, SkISize::Make(width, height), media::VideoFrame::RGB32)); |
| 90 capture_data->set_dpi(SkIPoint::Make(96, 97)); |
| 91 encoder.Encode(capture_data, false, |
| 92 base::Bind(&EncoderDpiCallback::DataAvailable, |
| 93 base::Unretained(&callback))); |
| 94 } |
| 95 |
| 65 } // namespace remoting | 96 } // namespace remoting |
| OLD | NEW |