summaryrefslogtreecommitdiffstats
path: root/remoting/test/test_video_renderer.cc
blob: 864356a112cb3ac37cd152516ec8cab26ad36ea5 (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
// Copyright 2015 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/test/test_video_renderer.h"

#include "base/logging.h"
#include "remoting/proto/video.pb.h"

namespace remoting {
namespace test {

TestVideoRenderer::TestVideoRenderer() : video_frames_processed_(0) {
}

TestVideoRenderer::~TestVideoRenderer() {
}

void TestVideoRenderer::OnSessionConfig(const protocol::SessionConfig& config) {
  DVLOG(2) << "TestVideoRenderer::OnSessionConfig() Called";
}

ChromotingStats* TestVideoRenderer::GetStats() {
  DVLOG(2) << "TestVideoRenderer::GetStats() Called";
  return nullptr;
}

protocol::VideoStub* TestVideoRenderer::GetVideoStub() {
  DVLOG(2) << "TestVideoRenderer::GetVideoStub() Called";
  return this;
}

void TestVideoRenderer::ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
                                           const base::Closure& done) {
  if (!video_packet->data().empty()) {
    // If the video frame was not a keep alive frame (i.e. not empty) then
    // count it.
    DVLOG(2) << "Video Packet Processed, Total: " << ++video_frames_processed_;
  } else {
    // Log at a high verbosity level as we receive empty packets frequently and
    // they can clutter up the debug output if the level is set too low.
    DVLOG(3) << "Empty Video Packet received.";
  }

  done.Run();
}

}  // namespace test
}  // namespace remoting