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

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

Issue 2963003: Changing UpdateStreamPacket protobuf definition for chromoting (Closed)
Patch Set: fixed comments Created 10 years, 5 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
« no previous file with comments | « remoting/base/protocol_decoder_unittest.cc ('k') | remoting/client/decoder_verbatim.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_DECODER_H_ 5 #ifndef REMOTING_CLIENT_DECODER_H_
6 #define REMOTING_CLIENT_DECODER_H_ 6 #define REMOTING_CLIENT_DECODER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // the codec format. 50 // the codec format.
51 // TODO(hclam): Provide more information when calling this function. 51 // TODO(hclam): Provide more information when calling this function.
52 virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame, 52 virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame,
53 UpdatedRects* updated_rects, 53 UpdatedRects* updated_rects,
54 Task* partial_decode_done, 54 Task* partial_decode_done,
55 Task* decode_done) = 0; 55 Task* decode_done) = 0;
56 56
57 // Give a HostMessage that contains the update stream packet that contains 57 // Give a HostMessage that contains the update stream packet that contains
58 // the encoded data to the decoder. 58 // the encoded data to the decoder.
59 // The decoder will own |message| and is responsible for deleting it. 59 // The decoder will own |message| and is responsible for deleting it.
60 //
60 // If the decoder has written something into |frame|, 61 // If the decoder has written something into |frame|,
61 // |partial_decode_done_| is called with |frame| and updated regions. 62 // |partial_decode_done_| is called with |frame| and updated regions.
62 // Return true if the decoder can accept |message| and decode it. 63 // Return true if the decoder can accept |message| and decode it.
64 //
65 // HostMessage returned by this method will contain a
66 // UpdateStreamPacketMessage.
67 // This message will contain either:
68 // 1. UpdateStreamBeginRect
69 // 2. UpdateStreamRectData
70 // 3. UpdateStreamEndRect
71 //
72 // See remoting/base/protocol/chromotocol.proto for more information about
73 // these messages.
63 virtual bool PartialDecode(HostMessage* message) = 0; 74 virtual bool PartialDecode(HostMessage* message) = 0;
64 75
65 // Notify the decoder that we have received the last update stream packet. 76 // Notify the decoder that we have received the last update stream packet.
66 // If the decoding of the update stream has completed |decode_done_| is 77 // If the decoding of the update stream has completed |decode_done_| is
67 // called with |frame|. 78 // called with |frame|.
68 // If the update stream is not received fully and this method is called the 79 // If the update stream is not received fully and this method is called the
69 // decoder should also call |decode_done_| as soon as possible. 80 // decoder should also call |decode_done_| as soon as possible.
70 virtual void EndDecode() = 0; 81 virtual void EndDecode() = 0;
82
83 protected:
84 // Every decoder will have two internal states because there are three
85 // kinds of messages send to PartialDecode().
86 //
87 // Here's a state diagram:
88 //
89 // UpdateStreamBeginRect UpdateStreamRectData
90 // .............. ............
91 // . . . .
92 // . v . .
93 // kWaitingForBeginRect kWaitingForRectData .
94 // ^ . ^ .
95 // . . . .
96 // .............. ............
97 // UpdateStreaEndRect
98 enum State {
99 // In this state the decoder is waiting for UpdateStreamBeginRect.
100 // After receiving UpdateStreaBeginRect, the encoder will transit to
101 // to kWaitingForRectData state.
102 kWaitingForBeginRect,
103
104 // In this state the decoder is waiting for UpdateStreamRectData.
105 // The decode remains in this state if UpdateStreamRectData is received.
106 // The decoder will transit to kWaitingForBeginRect if UpdateStreamEndRect
107 // is received.
108 kWaitingForRectData,
109 };
71 }; 110 };
72 111
73 } // namespace remoting 112 } // namespace remoting
74 113
75 #endif // REMOTING_CLIENT_DECODER_H_ 114 #endif // REMOTING_CLIENT_DECODER_H_
OLDNEW
« no previous file with comments | « remoting/base/protocol_decoder_unittest.cc ('k') | remoting/client/decoder_verbatim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698