OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef REMOTING_CLIENT_VIDEO_RENDERER_H_ | 5 #ifndef REMOTING_CLIENT_VIDEO_RENDERER_H_ |
6 #define REMOTING_CLIENT_VIDEO_RENDERER_H_ | 6 #define REMOTING_CLIENT_VIDEO_RENDERER_H_ |
7 | 7 |
8 namespace remoting { | 8 namespace remoting { |
9 | 9 |
10 class ClientContext; | 10 class ClientContext; |
11 | 11 |
12 namespace protocol { | 12 namespace protocol { |
13 | 13 |
14 class FrameConsumer; | 14 class FrameConsumer; |
15 class PerformanceTracker; | 15 class FrameStatsConsumer; |
16 class SessionConfig; | 16 class SessionConfig; |
17 class VideoStub; | 17 class VideoStub; |
18 | 18 |
19 // VideoRenderer is responsible for decoding and displaying incoming video | 19 // VideoRenderer is responsible for decoding and displaying incoming video |
20 // stream. This interface is used by ConnectionToHost implementations to | 20 // stream. This interface is used by ConnectionToHost implementations to |
21 // render received video frames. ConnectionToHost may feed encoded frames to the | 21 // render received video frames. ConnectionToHost may feed encoded frames to the |
22 // VideoStub or decode them and pass decoded frames to the FrameConsumer. | 22 // VideoStub or decode them and pass decoded frames to the FrameConsumer. If the |
| 23 // implementation uses FrameConsumer directly then it must also call |
| 24 // FrameStatsConsumer with FrameStats for each frame. |
23 // | 25 // |
24 // TODO(sergeyu): Reconsider this design. | 26 // TODO(sergeyu): Reconsider this design. |
25 class VideoRenderer { | 27 class VideoRenderer { |
26 public: | 28 public: |
27 virtual ~VideoRenderer() {} | 29 virtual ~VideoRenderer() {} |
28 | 30 |
29 // Initializes the video renderer. This allows the renderer to be initialized | 31 // Initializes the video renderer. This allows the renderer to be initialized |
30 // after it is constructed. Returns true if initialization succeeds and false | 32 // after it is constructed. Returns true if initialization succeeds and false |
31 // otherwise. An implementation that doesn't use this function to initialize | 33 // otherwise. An implementation that doesn't use this function to initialize |
32 // should always return true. | 34 // should always return true. |
33 // |perf_tracker| must outlive the renderer. | 35 // |perf_tracker| must outlive the renderer. |
34 virtual bool Initialize(const ClientContext& client_context, | 36 virtual bool Initialize(const ClientContext& client_context, |
35 protocol::PerformanceTracker* perf_tracker) = 0; | 37 protocol::FrameStatsConsumer* stats_consumer) = 0; |
36 | 38 |
37 // Configures the renderer with the supplied |config|. This must be called | 39 // Configures the renderer with the supplied |config|. This must be called |
38 // exactly once before video data is supplied to the renderer. | 40 // exactly once before video data is supplied to the renderer. |
39 virtual void OnSessionConfig(const SessionConfig& config) = 0; | 41 virtual void OnSessionConfig(const SessionConfig& config) = 0; |
40 | 42 |
41 // Returns the VideoStub interface of this renderer. | 43 // Returns the VideoStub interface of this renderer. |
42 virtual VideoStub* GetVideoStub() = 0; | 44 virtual VideoStub* GetVideoStub() = 0; |
43 | 45 |
44 // Returns the FrameConsumer interface for this renderer. | 46 // Returns the FrameConsumer interface for this renderer. |
45 virtual FrameConsumer* GetFrameConsumer() = 0; | 47 virtual FrameConsumer* GetFrameConsumer() = 0; |
| 48 |
| 49 // Returns the FrameStatsConsumer interface for this renderer. |
| 50 virtual FrameStatsConsumer* GetFrameStatsConsumer() = 0; |
46 }; | 51 }; |
47 | 52 |
48 } // namespace protocol | 53 } // namespace protocol |
49 } // namespace remoting | 54 } // namespace remoting |
50 | 55 |
51 #endif // REMOTING_CLIENT_VIDEO_RENDERER_H_ | 56 #endif // REMOTING_CLIENT_VIDEO_RENDERER_H_ |
OLD | NEW |