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

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

Issue 1846893002: Interface with webrtc through encoded frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sergey comment Created 4 years, 8 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.h » ('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) {
66 return base::WrapUnique(EncodePtr(frame)); 67 return base::WrapUnique(EncodePtr(frame));
67 } 68 }
68 }; 69 };
69 70
70 } // namespace 71 } // namespace
71 72
72 static const int kWidth = 640; 73 static const int kWidth = 640;
73 static const int kHeight = 480; 74 static const int kHeight = 480;
74 75
75 class ThreadCheckVideoEncoder : public VideoEncoderVerbatim { 76 class ThreadCheckVideoEncoder : public VideoEncoderVerbatim {
76 public: 77 public:
77 ThreadCheckVideoEncoder( 78 ThreadCheckVideoEncoder(
78 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
79 : task_runner_(task_runner) { 80 : task_runner_(task_runner) {
80 } 81 }
81 ~ThreadCheckVideoEncoder() override { 82 ~ThreadCheckVideoEncoder() override {
82 EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); 83 EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
83 } 84 }
84 85
85 std::unique_ptr<VideoPacket> Encode( 86 std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame,
86 const webrtc::DesktopFrame& frame) override { 87 uint32_t flags) override {
87 return base::WrapUnique(new VideoPacket()); 88 return base::WrapUnique(new VideoPacket());
88 } 89 }
89 90
90 private: 91 private:
91 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 92 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
92 93
93 DISALLOW_COPY_AND_ASSIGN(ThreadCheckVideoEncoder); 94 DISALLOW_COPY_AND_ASSIGN(ThreadCheckVideoEncoder);
94 }; 95 };
95 96
96 class ThreadCheckDesktopCapturer : public webrtc::DesktopCapturer { 97 class ThreadCheckDesktopCapturer : public webrtc::DesktopCapturer {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // Start video frame capture. 237 // Start video frame capture.
237 pump_.reset(new VideoFramePump(encode_task_runner_, std::move(capturer), 238 pump_.reset(new VideoFramePump(encode_task_runner_, std::move(capturer),
238 std::move(encoder), &video_stub_)); 239 std::move(encoder), &video_stub_));
239 240
240 // Run MessageLoop until the first frame is received. 241 // Run MessageLoop until the first frame is received.
241 run_loop.Run(); 242 run_loop.Run();
242 } 243 }
243 244
244 } // namespace protocol 245 } // namespace protocol
245 } // namespace remoting 246 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/video_frame_pump.cc ('k') | remoting/protocol/webrtc_connection_to_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698