blob: d30c4addbab027dedeaaf3c92a8dac2911056590 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "remoting/protocol/fake_video_renderer.h"
#include <utility>
#include "base/callback.h"
#include "base/logging.h"
#include "remoting/proto/video.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
namespace remoting {
namespace protocol {
FakeVideoStub::FakeVideoStub() {}
FakeVideoStub::~FakeVideoStub() {}
void FakeVideoStub::set_on_frame_callback(base::Closure on_frame_callback) {
CHECK(thread_checker_.CalledOnValidThread());
on_frame_callback_ = on_frame_callback;
}
void FakeVideoStub::ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
const base::Closure& done) {
CHECK(thread_checker_.CalledOnValidThread());
received_packets_.push_back(std::move(video_packet));
if (!done.is_null())
done.Run();
if (!on_frame_callback_.is_null())
on_frame_callback_.Run();
}
FakeFrameConsumer::FakeFrameConsumer() {}
FakeFrameConsumer::~FakeFrameConsumer() {}
void FakeFrameConsumer::set_on_frame_callback(base::Closure on_frame_callback) {
CHECK(thread_checker_.CalledOnValidThread());
on_frame_callback_ = on_frame_callback;
}
scoped_ptr<webrtc::DesktopFrame> FakeFrameConsumer::AllocateFrame(
const webrtc::DesktopSize& size) {
CHECK(thread_checker_.CalledOnValidThread());
return make_scoped_ptr(new webrtc::BasicDesktopFrame(size));
}
void FakeFrameConsumer::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
const base::Closure& done) {
CHECK(thread_checker_.CalledOnValidThread());
received_frames_.push_back(std::move(frame));
if (!done.is_null())
done.Run();
if (!on_frame_callback_.is_null())
on_frame_callback_.Run();
}
FrameConsumer::PixelFormat FakeFrameConsumer::GetPixelFormat() {
CHECK(thread_checker_.CalledOnValidThread());
return FORMAT_BGRA;
}
FakeVideoRenderer::FakeVideoRenderer() {}
FakeVideoRenderer::~FakeVideoRenderer() {}
void FakeVideoRenderer::OnSessionConfig(const SessionConfig& config) {}
FakeVideoStub* FakeVideoRenderer::GetVideoStub() {
CHECK(thread_checker_.CalledOnValidThread());
return &video_stub_;
}
FakeFrameConsumer* FakeVideoRenderer::GetFrameConsumer() {
CHECK(thread_checker_.CalledOnValidThread());
return &frame_consumer_;
}
} // namespace protocol
} // namespace remoting
|