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

Side by Side Diff: remoting/codec/video_encoder_vpx_unittest.cc

Issue 28183002: Add VP9 encode support to the remoting host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 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 "remoting/codec/video_encoder_vpx.h" 5 #include "remoting/codec/video_encoder_vpx.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "remoting/codec/codec_test.h" 11 #include "remoting/codec/codec_test.h"
12 #include "remoting/proto/video.pb.h" 12 #include "remoting/proto/video.pb.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
15 15
16 namespace { 16 namespace {
17 17
18 const int kIntMax = std::numeric_limits<int>::max(); 18 const int kIntMax = std::numeric_limits<int>::max();
19 19
20 } // namespace 20 } // namespace
21 21
22 namespace remoting { 22 namespace remoting {
23 23
24 TEST(VideoEncoderVpxTest, TestVideoEncoder) { 24 TEST(VideoEncoderVp8Test, TestVideoEncoder) {
25 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); 25 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
26 TestVideoEncoder(encoder.get(), false); 26 TestVideoEncoder(encoder.get(), false);
27 } 27 }
28 28
29 // Test that calling Encode with a differently-sized media::ScreenCaptureData 29 // Test that calling Encode with a differently-sized media::ScreenCaptureData
30 // does not leak memory. 30 // does not leak memory.
31 TEST(VideoEncoderVpxTest, TestSizeChangeNoLeak) { 31 TEST(VideoEncoderVp8Test, TestSizeChangeNoLeak) {
32 int height = 1000; 32 int height = 1000;
33 int width = 1000; 33 int width = 1000;
34 34
35 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); 35 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
36 36
37 scoped_ptr<webrtc::DesktopFrame> frame( 37 scoped_ptr<webrtc::DesktopFrame> frame(
38 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); 38 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height)));
39 39
40 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); 40 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
41 EXPECT_TRUE(packet); 41 EXPECT_TRUE(packet);
42 42
43 height /= 2; 43 height /= 2;
44 frame.reset( 44 frame.reset(
45 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); 45 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height)));
46 packet = encoder->Encode(*frame); 46 packet = encoder->Encode(*frame);
47 EXPECT_TRUE(packet); 47 EXPECT_TRUE(packet);
48 } 48 }
49 49
50 // Test that the DPI information is correctly propagated from the 50 // Test that the DPI information is correctly propagated from the
51 // media::ScreenCaptureData to the VideoPacket. 51 // media::ScreenCaptureData to the VideoPacket.
52 TEST(VideoEncoderVpxTest, TestDpiPropagation) { 52 TEST(VideoEncoderVp8Test, TestDpiPropagation) {
53 int height = 32; 53 int height = 32;
54 int width = 32; 54 int width = 32;
55 55
56 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); 56 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
57 57
58 scoped_ptr<webrtc::DesktopFrame> frame( 58 scoped_ptr<webrtc::DesktopFrame> frame(
59 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height))); 59 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(width, height)));
60 frame->set_dpi(webrtc::DesktopVector(96, 97)); 60 frame->set_dpi(webrtc::DesktopVector(96, 97));
61 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); 61 scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
62 EXPECT_EQ(packet->format().x_dpi(), 96); 62 EXPECT_EQ(packet->format().x_dpi(), 96);
63 EXPECT_EQ(packet->format().y_dpi(), 97); 63 EXPECT_EQ(packet->format().y_dpi(), 97);
64 } 64 }
65 65
66 } // namespace remoting 66 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698