video_renderer.h 1.99 KB
Newer Older
1
// Copyright 2016 The Chromium Authors. All rights reserved.
2 3 4 5 6 7 8
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_CLIENT_VIDEO_RENDERER_H_
#define REMOTING_CLIENT_VIDEO_RENDERER_H_

namespace remoting {
9 10 11

class ClientContext;

12
namespace protocol {
13

14
class FrameConsumer;
sergeyu's avatar
sergeyu committed
15
class FrameStatsConsumer;
16
class SessionConfig;
17
class VideoStub;
18 19

// VideoRenderer is responsible for decoding and displaying incoming video
20 21
// stream. This interface is used by ConnectionToHost implementations to
// render received video frames. ConnectionToHost may feed encoded frames to the
sergeyu's avatar
sergeyu committed
22 23 24
// VideoStub or decode them and pass decoded frames to the FrameConsumer. If the
// implementation uses FrameConsumer directly then it must also call
// FrameStatsConsumer with FrameStats for each frame.
25 26
//
// TODO(sergeyu): Reconsider this design.
27
class VideoRenderer {
28
 public:
29 30
  virtual ~VideoRenderer() {}

31 32 33 34 35 36
  // Initializes the video renderer. This allows the renderer to be initialized
  // after it is constructed. Returns true if initialization succeeds and false
  // otherwise. An implementation that doesn't use this function to initialize
  // should always return true.
  // |perf_tracker| must outlive the renderer.
  virtual bool Initialize(const ClientContext& client_context,
sergeyu's avatar
sergeyu committed
37
                          protocol::FrameStatsConsumer* stats_consumer) = 0;
38

39 40
  // Configures the renderer with the supplied |config|. This must be called
  // exactly once before video data is supplied to the renderer.
41
  virtual void OnSessionConfig(const SessionConfig& config) = 0;
42

43
  // Returns the VideoStub interface of this renderer.
44
  virtual VideoStub* GetVideoStub() = 0;
45 46 47

  // Returns the FrameConsumer interface for this renderer.
  virtual FrameConsumer* GetFrameConsumer() = 0;
sergeyu's avatar
sergeyu committed
48 49 50

  // Returns the FrameStatsConsumer interface for this renderer.
  virtual FrameStatsConsumer* GetFrameStatsConsumer() = 0;
51 52
};

53
}  // namespace protocol
54 55 56
}  // namespace remoting

#endif  // REMOTING_CLIENT_VIDEO_RENDERER_H_