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

Side by Side Diff: remoting/test/fake_socket_factory.cc

Issue 1866283004: Fix bandwidth estimation on remoting webrtc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/chromium_socket_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "remoting/test/fake_socket_factory.h" 8 #include "remoting/test/fake_socket_factory.h"
9 9
10 #include <math.h> 10 #include <math.h>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 int FakeUdpSocket::SendTo(const void* data, size_t data_size, 115 int FakeUdpSocket::SendTo(const void* data, size_t data_size,
116 const rtc::SocketAddress& address, 116 const rtc::SocketAddress& address,
117 const rtc::PacketOptions& options) { 117 const rtc::PacketOptions& options) {
118 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(data_size); 118 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(data_size);
119 memcpy(buffer->data(), data, data_size); 119 memcpy(buffer->data(), data, data_size);
120 cricket::ApplyPacketOptions( 120 cricket::ApplyPacketOptions(
121 reinterpret_cast<uint8_t*>(buffer->data()), data_size, 121 reinterpret_cast<uint8_t*>(buffer->data()), data_size,
122 options.packet_time_params, 122 options.packet_time_params,
123 (base::TimeTicks::Now() - base::TimeTicks()).InMilliseconds()); 123 (base::TimeTicks::Now() - base::TimeTicks()).InMicroseconds());
124 dispatcher_->DeliverPacket(local_address_, address, buffer, data_size); 124 dispatcher_->DeliverPacket(local_address_, address, buffer, data_size);
125 return data_size; 125 return data_size;
126 } 126 }
127 127
128 int FakeUdpSocket::Close() { 128 int FakeUdpSocket::Close() {
129 state_ = STATE_CLOSED; 129 state_ = STATE_CLOSED;
130 return 0; 130 return 0;
131 } 131 }
132 132
133 rtc::AsyncPacketSocket::State FakeUdpSocket::GetState() const { 133 rtc::AsyncPacketSocket::State FakeUdpSocket::GetState() const {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 UdpSocketsMap::iterator iter = udp_sockets_.find(packet.to.port()); 334 UdpSocketsMap::iterator iter = udp_sockets_.find(packet.to.port());
335 if (iter == udp_sockets_.end()) { 335 if (iter == udp_sockets_.end()) {
336 // Invalid port number. 336 // Invalid port number.
337 return; 337 return;
338 } 338 }
339 339
340 iter->second.Run(packet.from, packet.to, packet.data, packet.data_size); 340 iter->second.Run(packet.from, packet.to, packet.data, packet.data_size);
341 } 341 }
342 342
343 } // namespace remoting 343 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/chromium_socket_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698