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

Side by Side Diff: remoting/protocol/video_frame_pump_unittest.cc

Issue 2329653002: Add WebrtcVideoEncoder interface (Closed)
Patch Set: win Created 4 years, 3 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
« no previous file with comments | « remoting/protocol/video_frame_pump.cc ('k') | remoting/protocol/webrtc_connection_to_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/protocol/video_frame_pump.h" 5 #include "remoting/protocol/video_frame_pump.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 class MockVideoEncoder : public VideoEncoder { 56 class MockVideoEncoder : public VideoEncoder {
57 public: 57 public:
58 MockVideoEncoder() {} 58 MockVideoEncoder() {}
59 ~MockVideoEncoder() {} 59 ~MockVideoEncoder() {}
60 60
61 MOCK_METHOD1(SetLosslessEncode, void(bool)); 61 MOCK_METHOD1(SetLosslessEncode, void(bool));
62 MOCK_METHOD1(SetLosslessColor, void(bool)); 62 MOCK_METHOD1(SetLosslessColor, void(bool));
63 MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame&)); 63 MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame&));
64 64
65 std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame, 65 std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) {
66 uint32_t flags) {
67 return base::WrapUnique(EncodePtr(frame)); 66 return base::WrapUnique(EncodePtr(frame));
68 } 67 }
69 }; 68 };
70 69
71 } // namespace 70 } // namespace
72 71
73 static const int kWidth = 640; 72 static const int kWidth = 640;
74 static const int kHeight = 480; 73 static const int kHeight = 480;
75 74
76 class ThreadCheckVideoEncoder : public VideoEncoderVerbatim { 75 class ThreadCheckVideoEncoder : public VideoEncoderVerbatim {
77 public: 76 public:
78 ThreadCheckVideoEncoder( 77 ThreadCheckVideoEncoder(
79 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 78 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
80 : task_runner_(task_runner) { 79 : task_runner_(task_runner) {
81 } 80 }
82 ~ThreadCheckVideoEncoder() override { 81 ~ThreadCheckVideoEncoder() override {
83 EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); 82 EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
84 } 83 }
85 84
86 std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame, 85 std::unique_ptr<VideoPacket> Encode(
87 uint32_t flags) override { 86 const webrtc::DesktopFrame& frame) override {
88 return base::MakeUnique<VideoPacket>(); 87 return base::MakeUnique<VideoPacket>();
89 } 88 }
90 89
91 private: 90 private:
92 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
93 92
94 DISALLOW_COPY_AND_ASSIGN(ThreadCheckVideoEncoder); 93 DISALLOW_COPY_AND_ASSIGN(ThreadCheckVideoEncoder);
95 }; 94 };
96 95
97 class ThreadCheckDesktopCapturer : public webrtc::DesktopCapturer { 96 class ThreadCheckDesktopCapturer : public webrtc::DesktopCapturer {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Start video frame capture. 237 // Start video frame capture.
239 pump_.reset(new VideoFramePump(encode_task_runner_, std::move(capturer), 238 pump_.reset(new VideoFramePump(encode_task_runner_, std::move(capturer),
240 std::move(encoder), &video_stub_)); 239 std::move(encoder), &video_stub_));
241 240
242 // Run MessageLoop until the first frame is received. 241 // Run MessageLoop until the first frame is received.
243 run_loop.Run(); 242 run_loop.Run();
244 } 243 }
245 244
246 } // namespace protocol 245 } // namespace protocol
247 } // namespace remoting 246 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/video_frame_pump.cc ('k') | remoting/protocol/webrtc_connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698