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

Side by Side Diff: remoting/client/software_video_renderer.h

Issue 136763009: Add VideoProcessor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_CLIENT_SOFTWARE_VIDEO_RENDERER_H_
6 #define REMOTING_CLIENT_SOFTWARE_VIDEO_RENDERER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "remoting/client/chromoting_stats.h"
11 #include "remoting/client/frame_consumer_proxy.h"
12 #include "remoting/client/frame_producer.h"
13 #include "remoting/client/video_renderer.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
15
16 namespace base {
17 class SingleThreadTaskRunner;
18 } // namespace base
19
20 namespace remoting {
21
22 class ChromotingStats;
23
24 // Implementation of VideoRenderer interface that decodes frame on CPU (on a
25 // decode thread) and then passes decoded frames to a FrameConsumer.
26 // FrameProducer methods can be called on any thread. All other methods must be
Wez 2014/01/22 20:17:31 How do we guarantee that that other thread doesn't
Sergey Ulanov 2014/01/23 01:02:43 Done.
27 // called in the main thread.
Wez 2014/01/22 20:17:31 nit: in -> on
Sergey Ulanov 2014/01/23 01:02:43 Done.
28 class SoftwareVideoRenderer : public VideoRenderer,
29 public FrameProducer,
30 public base::NonThreadSafe {
31 public:
32 // Creates an update decoder on |main_task_runner_| and |decode_task_runner_|,
33 // outputting to |consumer|. The |main_task_runner_| is responsible for
34 // receiving and queueing packets. The |decode_task_runner_| is responsible
35 // for decoding the video packets.
36 // TODO(wez): Replace the ref-counted proxy with an owned FrameConsumer.
37 SoftwareVideoRenderer(
38 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
39 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner,
40 scoped_refptr<FrameConsumerProxy> consumer);
41 virtual ~SoftwareVideoRenderer();
42
43 // VideoRenderer implementation.
44 virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE;
45 virtual ChromotingStats* GetStats() OVERRIDE;
46 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
47 const base::Closure& done) OVERRIDE;
48
49 // FrameProducer implementation. These methods may be called before we are
50 // Initialize()d, or we know the source screen size. These methods may be
51 // called on any thread.
52 //
53 // TODO(sergeyu): On Android a separate display thread is used for drawing.
54 // FrameConsumer calls FrameProducer on that thread. Can we avoid having a
55 // separate display thread? E.g. can we do everything on the decode thread?
56 virtual void DrawBuffer(webrtc::DesktopFrame* buffer) OVERRIDE;
57 virtual void InvalidateRegion(const webrtc::DesktopRegion& region) OVERRIDE;
58 virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE;
59 virtual void SetOutputSizeAndClip(
60 const webrtc::DesktopSize& view_size,
61 const webrtc::DesktopRect& clip_area) OVERRIDE;
62
63 private:
64 class Core;
65
66 // Callback method when a VideoPacket is processed. |decode_start| contains
67 // the timestamp when the packet will start to be processed.
68 void OnPacketDone(base::Time decode_start, const base::Closure& done);
69
70 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner_;
71 scoped_ptr<Core> core_;
72
73 ChromotingStats stats_;
74
75 // Keep track of the most recent sequence number bounced back from the host.
76 int64 latest_sequence_number_;
77
78 base::WeakPtrFactory<SoftwareVideoRenderer> weak_factory_;
79
80 DISALLOW_COPY_AND_ASSIGN(SoftwareVideoRenderer);
81 };
82
83 } // namespace remoting
84
85 #endif // REMOTING_CLIENT_SOFTWARE_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698