summaryrefslogtreecommitdiffstats
path: root/content/renderer/p2p
diff options
context:
space:
mode:
authormallinath@chromium.org <mallinath@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-16 13:51:39 +0000
committermallinath@chromium.org <mallinath@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-16 13:51:39 +0000
commit91dce6f7a64a00318c2c0dde764ca0a7e18bd0ae (patch)
treedeeec3b246ae9f046f8e24c25fe3dc3fd168990e /content/renderer/p2p
parent10f003375bfa997d1139981845c22bb823d4c71f (diff)
downloadchromium_src-91dce6f7a64a00318c2c0dde764ca0a7e18bd0ae.zip
chromium_src-91dce6f7a64a00318c2c0dde764ca0a7e18bd0ae.tar.gz
chromium_src-91dce6f7a64a00318c2c0dde764ca0a7e18bd0ae.tar.bz2
Pass packet received timestamp in microseconds from
browser process to render process. This timestamp will be used by the webrtc for remote bandwidth estimation. Currently webrtc does this in render proces. Due to sandboxing of chrome render process will have delay when it calculates from the actual receive value. R=sergeyu@chromium.org, cdn@chromium.org, joi@chromium.org, sergeyu@chromuim.org TBR=cdn@chromium.org, joi@chromium.org Review URL: https://codereview.chromium.org/104783004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/p2p')
-rw-r--r--content/renderer/p2p/ipc_socket_factory.cc8
-rw-r--r--content/renderer/p2p/socket_client_impl.cc13
-rw-r--r--content/renderer/p2p/socket_client_impl.h6
-rw-r--r--content/renderer/p2p/socket_dispatcher.cc5
-rw-r--r--content/renderer/p2p/socket_dispatcher.h3
5 files changed, 23 insertions, 12 deletions
diff --git a/content/renderer/p2p/ipc_socket_factory.cc b/content/renderer/p2p/ipc_socket_factory.cc
index 449a773..f2d1fe9 100644
--- a/content/renderer/p2p/ipc_socket_factory.cc
+++ b/content/renderer/p2p/ipc_socket_factory.cc
@@ -70,7 +70,8 @@ class IpcPacketSocket : public talk_base::AsyncPacketSocket,
virtual void OnSendComplete() OVERRIDE;
virtual void OnError() OVERRIDE;
virtual void OnDataReceived(const net::IPEndPoint& address,
- const std::vector<char>& data) OVERRIDE;
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp) OVERRIDE;
private:
enum InternalState {
@@ -381,7 +382,8 @@ void IpcPacketSocket::OnError() {
}
void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address,
- const std::vector<char>& data) {
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp) {
DCHECK_EQ(base::MessageLoop::current(), message_loop_);
talk_base::SocketAddress address_lj;
@@ -392,6 +394,8 @@ void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address,
return;
}
+ // TODO(mallinath) - Pass timestamp after updating the libjingle.
+ // talk_base::PacketTime packet_time(timestamp.ToInternalValue(), 0);
SignalReadPacket(this, &data[0], data.size(), address_lj);
}
diff --git a/content/renderer/p2p/socket_client_impl.cc b/content/renderer/p2p/socket_client_impl.cc
index bc7865f..b0d5849 100644
--- a/content/renderer/p2p/socket_client_impl.cc
+++ b/content/renderer/p2p/socket_client_impl.cc
@@ -213,7 +213,8 @@ void P2PSocketClientImpl::DeliverOnError() {
}
void P2PSocketClientImpl::OnDataReceived(const net::IPEndPoint& address,
- const std::vector<char>& data) {
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp) {
DCHECK(ipc_message_loop_->BelongsToCurrentThread());
DCHECK_EQ(STATE_OPEN, state_);
delegate_message_loop_->PostTask(
@@ -221,14 +222,16 @@ void P2PSocketClientImpl::OnDataReceived(const net::IPEndPoint& address,
base::Bind(&P2PSocketClientImpl::DeliverOnDataReceived,
this,
address,
- data));
+ data,
+ timestamp));
}
-void P2PSocketClientImpl::DeliverOnDataReceived(const net::IPEndPoint& address,
- const std::vector<char>& data) {
+void P2PSocketClientImpl::DeliverOnDataReceived(
+ const net::IPEndPoint& address, const std::vector<char>& data,
+ const base::TimeTicks& timestamp) {
DCHECK(delegate_message_loop_->BelongsToCurrentThread());
if (delegate_)
- delegate_->OnDataReceived(address, data);
+ delegate_->OnDataReceived(address, data, timestamp);
}
void P2PSocketClientImpl::Detach() {
diff --git a/content/renderer/p2p/socket_client_impl.h b/content/renderer/p2p/socket_client_impl.h
index 9a4b632..305a993 100644
--- a/content/renderer/p2p/socket_client_impl.h
+++ b/content/renderer/p2p/socket_client_impl.h
@@ -76,7 +76,8 @@ class P2PSocketClientImpl : public P2PSocketClient {
void OnSendComplete();
void OnError();
void OnDataReceived(const net::IPEndPoint& address,
- const std::vector<char>& data);
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp);
// Proxy methods that deliver messages to the delegate thread.
void DeliverOnSocketCreated(const net::IPEndPoint& address);
@@ -86,7 +87,8 @@ class P2PSocketClientImpl : public P2PSocketClient {
void DeliverOnSendComplete();
void DeliverOnError();
void DeliverOnDataReceived(const net::IPEndPoint& address,
- const std::vector<char>& data);
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp);
// Scheduled on the IPC thread to finish initialization.
void DoInit(P2PSocketType type,
diff --git a/content/renderer/p2p/socket_dispatcher.cc b/content/renderer/p2p/socket_dispatcher.cc
index 0dc2591..1b2a6fc 100644
--- a/content/renderer/p2p/socket_dispatcher.cc
+++ b/content/renderer/p2p/socket_dispatcher.cc
@@ -169,10 +169,11 @@ void P2PSocketDispatcher::OnError(int socket_id) {
void P2PSocketDispatcher::OnDataReceived(
int socket_id, const net::IPEndPoint& address,
- const std::vector<char>& data) {
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp) {
P2PSocketClientImpl* client = GetClient(socket_id);
if (client) {
- client->OnDataReceived(address, data);
+ client->OnDataReceived(address, data, timestamp);
}
}
diff --git a/content/renderer/p2p/socket_dispatcher.h b/content/renderer/p2p/socket_dispatcher.h
index 664d1e0..b1bea29 100644
--- a/content/renderer/p2p/socket_dispatcher.h
+++ b/content/renderer/p2p/socket_dispatcher.h
@@ -100,7 +100,8 @@ class CONTENT_EXPORT P2PSocketDispatcher
void OnSendComplete(int socket_id);
void OnError(int socket_id);
void OnDataReceived(int socket_id, const net::IPEndPoint& address,
- const std::vector<char>& data);
+ const std::vector<char>& data,
+ const base::TimeTicks& timestamp);
P2PSocketClientImpl* GetClient(int socket_id);