summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-07-20 11:33:57 +0200
committerAlexander Larsson <alexl@redhat.com>2010-07-20 11:33:57 +0200
commit5f664e0ffb62c4a1d13b7647aea3c1115150eb88 (patch)
treeea208c5e9e2e525fcf2ac05136db61f0e3b37e69
parent74b470eeded366115b0c660288eccdf2f5291336 (diff)
downloadspice-5f664e0ffb62c4a1d13b7647aea3c1115150eb88.tar.gz
spice-5f664e0ffb62c4a1d13b7647aea3c1115150eb88.tar.xz
spice-5f664e0ffb62c4a1d13b7647aea3c1115150eb88.zip
Don't send padding over the network with video data
-rw-r--r--client/display_channel.cpp9
-rw-r--r--common/messages.h1
-rw-r--r--server/red_worker.c7
-rw-r--r--spice.proto2
-rw-r--r--spice1.proto4
5 files changed, 8 insertions, 15 deletions
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index e66f845e..4f89e066 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -158,7 +158,7 @@ public:
SpiceRect* dest, int clip_type, uint32_t num_clip_rects, SpiceRect* clip_rects);
~VideoStream();
- void push_data(uint32_t mm_time, uint32_t length, uint8_t* data, uint32_t pad_size);
+ void push_data(uint32_t mm_time, uint32_t length, uint8_t* data);
void set_clip(int type, uint32_t num_clip_rects, SpiceRect* clip_rects);
const SpiceRect& get_dest() {return _dest;}
void handle_update_mark(uint64_t update_mark);
@@ -445,7 +445,7 @@ uint32_t VideoStream::alloc_frame_slot()
return frame_slot(_frames_head++);
}
-void VideoStream::push_data(uint32_t mm_time, uint32_t length, uint8_t* data, uint32_t pad_size)
+void VideoStream::push_data(uint32_t mm_time, uint32_t length, uint8_t* data)
{
maintenance();
uint32_t frame_slot = alloc_frame_slot();
@@ -1345,12 +1345,11 @@ void DisplayChannel::handle_stream_data(RedPeer::InMessage* message)
THROW("invalid stream");
}
- if (message->size() < sizeof(SpiceMsgDisplayStreamData) + stream_data->data_size + stream_data->pad_size) {
+ if (message->size() < sizeof(SpiceMsgDisplayStreamData) + stream_data->data_size) {
THROW("access violation");
}
- stream->push_data(stream_data->multi_media_time, stream_data->data_size, stream_data->data,
- stream_data->pad_size);
+ stream->push_data(stream_data->multi_media_time, stream_data->data_size, stream_data->data);
}
void DisplayChannel::handle_stream_clip(RedPeer::InMessage* message)
diff --git a/common/messages.h b/common/messages.h
index 8af38f59..1a60a9fa 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -288,7 +288,6 @@ typedef struct SpiceMsgDisplayStreamData {
uint32_t id;
uint32_t multi_media_time;
uint32_t data_size;
- uint32_t pad_size;
uint8_t data[0];
} SpiceMsgDisplayStreamData;
diff --git a/server/red_worker.c b/server/red_worker.c
index bfb45607..bc3a7a36 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8012,8 +8012,6 @@ static int red_rgb16bpp_to_24 (RedWorker *worker, const SpiceRect *src,
return TRUE;
}
-#define PADDING 8 /* old ffmpeg padding */
-
static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable *drawable)
{
Stream *stream = drawable->stream;
@@ -8074,7 +8072,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
while ((n = mjpeg_encoder_encode_frame(stream->mjpeg_encoder,
display_channel->send_data.stream_outbuf,
- display_channel->send_data.stream_outbuf_size - PADDING)) == 0) {
+ display_channel->send_data.stream_outbuf_size)) == 0) {
uint8_t *new_buf;
size_t new_size;
@@ -8095,10 +8093,9 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
stream_data.id = stream - worker->streams_buf;
stream_data.multi_media_time = drawable->red_drawable->mm_time;
stream_data.data_size = n;
- stream_data.pad_size = PADDING;
spice_marshall_msg_display_stream_data(channel->send_data.marshaller, &stream_data);
spice_marshaller_add_ref(channel->send_data.marshaller,
- display_channel->send_data.stream_outbuf, n + PADDING);
+ display_channel->send_data.stream_outbuf, n);
display_begin_send_message(display_channel, NULL);
agent->lats_send_time = time_now;
diff --git a/spice.proto b/spice.proto
index 3f7c30c9..3c0911d4 100644
--- a/spice.proto
+++ b/spice.proto
@@ -621,9 +621,7 @@ channel DisplayChannel : BaseChannel {
uint32 id;
uint32 multi_media_time;
uint32 data_size;
- uint32 pad_size;
uint8 data[data_size] @end @nomarshal;
- uint8 padding[pad_size] @end @ctype(uint8_t) @nomarshal; /* Uhm, why are we sending padding over network? */
} stream_data;
message {
diff --git a/spice1.proto b/spice1.proto
index e38a2145..ebb2d6f6 100644
--- a/spice1.proto
+++ b/spice1.proto
@@ -583,9 +583,9 @@ channel DisplayChannel : BaseChannel {
uint32 id;
uint32 multi_media_time;
uint32 data_size;
- uint32 pad_size;
+ uint32 pad_size @zero;
uint8 data[data_size] @end @nomarshal;
- uint8 padding[pad_size] @end @ctype(uint8_t) @nomarshal; /* Uhm, why are we sending padding over network? */
+ /* Ignore: uint8 padding[pad_size] */
} stream_data;
message {