diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 22:23:08 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 22:23:08 +0000 |
commit | 4e758b649512b9e6ab5c6c67f38572894062139d (patch) | |
tree | 5322a791926a0218d78c8d41afe03705a8a95e54 /remoting/proto | |
parent | 715126056fa8080cd3c5b21e513dd417ddd6c66f (diff) | |
download | chromium_src-4e758b649512b9e6ab5c6c67f38572894062139d.zip chromium_src-4e758b649512b9e6ab5c6c67f38572894062139d.tar.gz chromium_src-4e758b649512b9e6ab5c6c67f38572894062139d.tar.bz2 |
Cleanups in the video encoding decoding code. Reenable VP8.
1. Moved video-related protobuf messages from event.proto to video.proto. Removed those that we don't need anymore
2. Fixed naming for enums and some types.
3. Reenabled VP8.
4. Proper RGB-YUV converter for VP8 encoder.
5. Changed the capturer_fake to show more meaningful picture.
BUG=57374
TEST=unittests
Review URL: http://codereview.chromium.org/4136010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/proto')
-rw-r--r-- | remoting/proto/chromotocol.gyp | 3 | ||||
-rw-r--r-- | remoting/proto/event.proto | 137 | ||||
-rw-r--r-- | remoting/proto/internal.proto | 8 | ||||
-rw-r--r-- | remoting/proto/video.proto | 93 |
4 files changed, 100 insertions, 141 deletions
diff --git a/remoting/proto/chromotocol.gyp b/remoting/proto/chromotocol.gyp index 3d55d21..faab3e7 100644 --- a/remoting/proto/chromotocol.gyp +++ b/remoting/proto/chromotocol.gyp @@ -16,6 +16,7 @@ 'control.proto', 'event.proto', 'internal.proto', + 'video.proto', ], 'rules': [ { @@ -71,6 +72,8 @@ '<(out_dir)/event.pb.h', '<(out_dir)/internal.pb.cc', '<(out_dir)/internal.pb.h', + '<(out_dir)/video.pb.cc', + '<(out_dir)/video.pb.h', ], }, ], diff --git a/remoting/proto/event.proto b/remoting/proto/event.proto index 96c8fce..2526d78 100644 --- a/remoting/proto/event.proto +++ b/remoting/proto/event.proto @@ -1,7 +1,7 @@ // Copyright (c) 2010 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. -// + // Protocol for event messages. syntax = "proto2"; @@ -10,141 +10,6 @@ option optimize_for = LITE_RUNTIME; package remoting; -// A message that gets sent to the client after the client is connected to the -// host. It contains information that the client needs to know about the host. -// NEXT ID: 3 -message InitClientMessage { - required int32 width = 1; - required int32 height = 2; -} - -// A message to denote the beginning of an update stream. It will be followed -// by 0 or more UpdateStreamPacketMessages and then a EndUpdateStreamMessage. -// NEXT ID: 1 -message BeginUpdateStreamMessage { -} - -// A message to denote the end of an update stream. -// NEXT ID: 1 -message EndUpdateStreamMessage { -} - -// Identifies how the image was encoded. -enum UpdateStreamEncoding { - EncodingInvalid = -1; - EncodingNone = 0; - EncodingZlib = 1; - EncodingVp8 = 2; -} - -// Identifies the pixel format. -// Note that this list should match exactly the same as -// media::VideoFrame::Format in media/base/video_frame.h. -enum PixelFormat { - PixelFormatInvalid = 0; - PixelFormatRgb555 = 1; - PixelFormatRgb565 = 2; - PixelFormatRgb24 = 3; - PixelFormatRgb32 = 4; - PixelFormatRgba = 5; - PixelFormatYv12 = 6; - PixelFormatYv16 = 7; - PixelFormatNv12 = 8; - PixelFormatEmpty = 9; - PixelFormatAscii = 10; -} - -// A message that denotes the beginning of an updating rectangle in an update -// stream packet. -// NEXT ID: 6 -message UpdateStreamBeginRect { - // X,Y coordinates (in screen pixels) for origin of this update. - required int32 x = 1; - required int32 y = 2; - - // Width, height (in screen pixels) for this update. - required int32 width = 3; - required int32 height = 4; - - // The encoding used for this image update. - optional UpdateStreamEncoding encoding = 5 [default=EncodingNone]; - - // The pixel format of this image. - optional PixelFormat pixel_format = 6 [default=PixelFormatRgb24]; -} - -// A message that contains partial data for updating an rectangle in an -// update stream packet. -// NEXT ID: 3 -message UpdateStreamRectData { - // The sequence number of the partial data for updating a rectangle. - optional int32 sequence_number = 1 [default=0]; - - // The partial data for updating a rectangle. - required bytes data = 2; -} - -// A message that denotes the end of an updating rectangle. -// NEXT ID: 1 -message UpdateStreamEndRect { -} - -// A message to denote a partial update stream. -// NEXT ID: 4 -message UpdateStreamPacketMessage { - optional UpdateStreamBeginRect begin_rect = 1; - optional UpdateStreamRectData rect_data = 2; - optional UpdateStreamEndRect end_rect = 3; -} - -// TODO(ajwong): Determine if these fields should be optional or required. -message RectangleFormat { - // X,Y coordinates (in screen pixels) for origin of this update. - required int32 x = 1; - required int32 y = 2; - - // Width, height (in screen pixels) for this update. - required int32 width = 3; - required int32 height = 4; - - // The encoding used for this image update. - optional UpdateStreamEncoding encoding = 5 [default = EncodingInvalid]; - - // The pixel format of this image. - optional PixelFormat pixel_format = 6 [default = PixelFormatRgb24]; -} - -message RectangleUpdatePacket { - // Bitmasks for use in the flags field below. - // - // The encoder may fragment one update into multiple packets depending on - // how the encoder outputs data. Thus, one update can logically consist of - // multiple packets. The FIRST_PACKET and LAST_PACKET flags are used to - // indicate the start and end of a logical update. Here are notable - // consequences: - // * Both FIRST_PACKET and LAST_PACKET may be set if an update is only - // one packet long. - // * The RectangleFormat is only supplied in a FIRST_PACKET. - // * An local update cannot change format between a FIRST_PACKET and - // a LAST_PACKET. - // * All packets in one logical update must be processed in order, and - // packets may not be skipped. - enum Flags { - FIRST_PACKET = 1; - LAST_PACKET = 2; - } - optional int32 flags = 1 [default = 0]; - - // The sequence number of the partial data for updating a rectangle. - optional int32 sequence_number = 2 [default = 0]; - - // This is provided on the first packet of the rectangle data, when - // the flags has FIRST_PACKET set. - optional RectangleFormat format = 3; - - optional bytes encoded_rect = 4; -} - // Defines a keyboard event. // NEXT ID: 3 message KeyEvent { diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto index 2e74501..3319420 100644 --- a/remoting/proto/internal.proto +++ b/remoting/proto/internal.proto @@ -1,13 +1,14 @@ // Copyright (c) 2010 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. -// + // Internal messages as a unit for transmission in the wire. syntax = "proto2"; import "control.proto"; import "event.proto"; +import "video.proto"; option optimize_for = LITE_RUNTIME; @@ -18,10 +19,7 @@ package remoting; // NEXT ID: 5 message ChromotingHostMessage { optional InitClientMessage init_client= 1; - optional BeginUpdateStreamMessage begin_update_stream = 2; - optional EndUpdateStreamMessage end_update_stream = 3; - optional UpdateStreamPacketMessage update_stream_packet = 4; - optional RectangleUpdatePacket rectangle_update = 5; + optional VideoPacket video_packet = 2; } // Defines the message that is sent from the client to the host. diff --git a/remoting/proto/video.proto b/remoting/proto/video.proto new file mode 100644 index 0000000..c91a0a3 --- /dev/null +++ b/remoting/proto/video.proto @@ -0,0 +1,93 @@ +// Copyright (c) 2010 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. + +// Protocol for video messages. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; + +package remoting; + +// A message that gets sent to the client after the client is connected to the +// host. It contains information that the client needs to know about the host. +// NEXT ID: 3 +// TODO(sergeyu): Move to the control channel. +message InitClientMessage { + required int32 width = 1; + required int32 height = 2; +} + +// Identifies the pixel format. +// Note that this list should match exactly the same as +// media::VideoFrame::Format in media/base/video_frame.h. +enum PixelFormat { + PIXEL_FORMAT_INVALID = 0; + PIXEL_FORMAT_RGB555 = 1; + PIXEL_FORMAT_RGB565 = 2; + PIXEL_FORMAT_RGB24 = 3; + PIXEL_FORMAT_RGB32 = 4; + PIXEL_FORMAT_RGBA = 5; + PIXEL_FORMAT_YV12 = 6; + PIXEL_FORMAT_YV16 = 7; + PIXEL_FORMAT_NV12 = 8; + PIXEL_FORMAT_EMPTY = 9; + PIXEL_FORMAT_ASCII = 10; +} + +// TODO(ajwong): Determine if these fields should be optional or required. +message VideoPacketFormat { + // Identifies how the image was encoded. + enum Encoding { + ENCODING_INVALID = -1; + ENCODING_VERBATIM = 0; + ENCODING_ZLIB = 1; + ENCODING_VP8 = 2; + }; + + // X,Y coordinates (in screen pixels) for origin of this update. + optional int32 x = 1; + optional int32 y = 2; + + // Width, height (in screen pixels) for this update. + optional int32 width = 3; + optional int32 height = 4; + + // The encoding used for this image update. + optional Encoding encoding = 5 [default = ENCODING_INVALID]; + + // The pixel format of this image. + optional PixelFormat pixel_format = 6 [default = PIXEL_FORMAT_RGB24]; +} + +message VideoPacket { + // Bitmasks for use in the flags field below. + // + // The encoder may fragment one update into multiple packets depending on + // how the encoder outputs data. Thus, one update can logically consist of + // multiple packets. The FIRST_PACKET and LAST_PACKET flags are used to + // indicate the start and end of a logical update. Here are notable + // consequences: + // * Both FIRST_PACKET and LAST_PACKET may be set if an update is only + // one packet long. + // * The VideoPacketFormat is only supplied in a FIRST_PACKET. + // * An local update cannot change format between a FIRST_PACKET and + // a LAST_PACKET. + // * All packets in one logical update must be processed in order, and + // packets may not be skipped. + enum Flags { + FIRST_PACKET = 1; + LAST_PACKET = 2; + } + optional int32 flags = 1 [default = 0]; + + // The sequence number of the partial data for updating a rectangle. + optional int32 sequence_number = 2 [default = 0]; + + // This is provided on the first packet of the rectangle data, when + // the flags has FIRST_PACKET set. + optional VideoPacketFormat format = 3; + + optional bytes data = 4; +} |