blob: 3746e5f368e4bbc9bd28a69f6393a9f6b748e32f (
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
|
// Copyright (c) 2011 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.
#ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H
#define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H
#include "base/memory/scoped_ptr.h"
#include "base/task.h"
#include "media/base/video_frame.h"
#include "remoting/base/decoder.h"
#include "ui/gfx/size.h"
class MessageLoop;
namespace remoting {
class FrameConsumer;
class VideoPacketFormat;
class VideoPacket;
namespace protocol {
class SessionConfig;
} // namespace protocol
// TODO(ajwong): Re-examine this API, especially with regards to how error
// conditions on each step are reported. Should they be CHECKs? Logs? Other?
// TODO(sergeyu): Rename this class.
class RectangleUpdateDecoder :
public base::RefCountedThreadSafe<RectangleUpdateDecoder> {
public:
RectangleUpdateDecoder(MessageLoop* message_loop,
FrameConsumer* consumer);
// Initializes decoder with the infromation from the protocol config.
void Initialize(const protocol::SessionConfig* config);
// Decodes the contents of |packet| calling OnPartialFrameOutput() in the
// regsitered as data is avaialable. DecodePacket may keep a reference to
// |packet| so the |packet| must remain alive and valid until |done| is
// executed.
//
// TODO(ajwong): Should packet be a const pointer to make the lifetime
// more clear?
void DecodePacket(const VideoPacket* packet, Task* done);
private:
friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>;
~RectangleUpdateDecoder();
void AllocateFrame(const VideoPacket* packet, Task* done);
void ProcessPacketData(const VideoPacket* packet, Task* done);
// Pointers to infrastructure objects. Not owned.
MessageLoop* message_loop_;
FrameConsumer* consumer_;
gfx::Size initial_screen_size_;
scoped_ptr<Decoder> decoder_;
// The video frame that the decoder writes to.
scoped_refptr<media::VideoFrame> frame_;
bool frame_is_new_;
};
} // namespace remoting
DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder);
#endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H
|