summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/buffered_socket_writer.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 01:34:08 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 01:34:08 +0000
commit5bc7183a8a86f77d79187b545f4442c02b4b5da4 (patch)
tree5e8605f948381d4ee164ad3cf6b6c79fab37676f /remoting/protocol/buffered_socket_writer.h
parent5484722ea6f8b25aeca90ec2c7bd85b30143ee52 (diff)
downloadchromium_src-5bc7183a8a86f77d79187b545f4442c02b4b5da4.zip
chromium_src-5bc7183a8a86f77d79187b545f4442c02b4b5da4.tar.gz
chromium_src-5bc7183a8a86f77d79187b545f4442c02b4b5da4.tar.bz2
Simplified frame rate control in the chromoting host.
Insted of keeping semi-fixed frame rate, now capturing rate is controlled by how fast we can send data to the client. Capturing of frame n is started only after frame n-2 is sent (while n-1 is being encoded). This guarantees that we don't clog the video channel buffers, and that we start capturing only if we know that the frame will not need to wait for too long in the buffer. TEST=None BUG=None Review URL: http://codereview.chromium.org/5634002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68688 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/buffered_socket_writer.h')
-rw-r--r--remoting/protocol/buffered_socket_writer.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/remoting/protocol/buffered_socket_writer.h b/remoting/protocol/buffered_socket_writer.h
index c786c44..3ea127e 100644
--- a/remoting/protocol/buffered_socket_writer.h
+++ b/remoting/protocol/buffered_socket_writer.h
@@ -5,7 +5,7 @@
#ifndef REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_
#define REMOTING_PROTOCOL_BUFFERED_SOCKET_WRITER_H_
-#include <queue>
+#include <list>
#include "base/lock.h"
#include "base/ref_counted.h"
@@ -13,6 +13,7 @@
#include "net/socket/socket.h"
class MessageLoop;
+class Task;
namespace net {
class Socket;
@@ -45,7 +46,7 @@ class BufferedSocketWriterBase
// Puts a new data chunk in the buffer. Returns false and doesn't enqueue
// the data if called before Init(). Can be called on any thread.
- bool Write(scoped_refptr<net::IOBufferWithSize> buffer);
+ bool Write(scoped_refptr<net::IOBufferWithSize> buffer, Task* done_task);
// Returns current size of the buffer. Can be called on any thread.
int GetBufferSize();
@@ -58,11 +59,16 @@ class BufferedSocketWriterBase
void Close();
protected:
- typedef std::queue<scoped_refptr<net::IOBufferWithSize> > DataQueue;
+ class PendingPacket;
+ typedef std::list<PendingPacket*> DataQueue;
DataQueue queue_;
int buffer_size_;
+ // Removes element from the front of the queue and calls |done_task|
+ // for that element.
+ void PopQueue();
+
// Following three methods must be implemented in child classes.
// GetNextPacket() returns next packet that needs to be written to the
// socket. |buffer| must be set to NULL if there is nothing left in the queue.