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

Unified Diff: remoting/protocol/message_reader.cc

Issue 850983002: Implement video frame acknowledgements in the chromoting protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/message_reader.cc
diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc
index 6e3d5369bf2ca690b8e4d4ce740b176dbf30a4a9..9c1c516cc2af9386a07ff80ad93c797850f626ff 100644
--- a/remoting/protocol/message_reader.cc
+++ b/remoting/protocol/message_reader.cc
@@ -90,6 +90,11 @@ void MessageReader::HandleReadResult(int result) {
void MessageReader::OnDataReceived(net::IOBuffer* data, int data_size) {
DCHECK(CalledOnValidThread());
+
+ base::TimeTicks now = base::TimeTicks::Now();
+
+ if (message_decoder_.is_buffer_empty())
+ last_message_started_time_ = now;
Wez 2015/01/21 01:35:40 nit: Blank line after this? This logic doesn't se
Sergey Ulanov 2015/01/29 01:33:29 Yes, I noticed it myself too. Fixed now and update
message_decoder_.AddData(data, data_size);
// Get list of all new messages first, and then call the callback
@@ -99,16 +104,18 @@ void MessageReader::OnDataReceived(net::IOBuffer* data, int data_size) {
if (!buffer)
break;
pending_messages_++;
+ base::TimeDelta read_delay = now - last_message_started_time_;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::Bind(&MessageReader::RunCallback,
- weak_factory_.GetWeakPtr(),
- base::Passed(make_scoped_ptr(buffer))));
+ base::Bind(&MessageReader::RunCallback, weak_factory_.GetWeakPtr(),
+ base::Passed(make_scoped_ptr(buffer)), read_delay));
}
}
-void MessageReader::RunCallback(scoped_ptr<CompoundBuffer> message) {
- if (!message_received_callback_.is_null()){
+void MessageReader::RunCallback(scoped_ptr<CompoundBuffer> message,
+ base::TimeDelta read_delay) {
+ last_message_read_delay_ = read_delay;
+ if (!message_received_callback_.is_null()) {
message_received_callback_.Run(
message.Pass(),
base::Bind(&MessageReader::OnMessageDone, weak_factory_.GetWeakPtr()));

Powered by Google App Engine
This is Rietveld 408576698