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

Unified Diff: webrtc/base/testclient.cc

Issue 1944683002: Read recv timestamps from socket (posix only). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improve test. Created 4 years, 7 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
« no previous file with comments | « webrtc/base/testclient.h ('k') | webrtc/base/testutils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/testclient.cc
diff --git a/webrtc/base/testclient.cc b/webrtc/base/testclient.cc
index c7484fa54148e7aad249f75ddd3d070b26ecd0d4..2abf27d8c6ef9b5df92bbfed40029e8f3ffc9824 100644
--- a/webrtc/base/testclient.cc
+++ b/webrtc/base/testclient.cc
@@ -19,7 +19,7 @@ namespace rtc {
// NextPacket.
TestClient::TestClient(AsyncPacketSocket* socket)
- : socket_(socket), ready_to_send_(false) {
+ : socket_(socket), ready_to_send_(false), prev_packet_timestamp_(-1) {
packets_ = new std::vector<Packet*>();
socket_->SignalReadPacket.connect(this, &TestClient::OnPacket);
socket_->SignalReadyToSend.connect(this, &TestClient::OnReadyToSend);
@@ -90,7 +90,12 @@ bool TestClient::CheckNextPacket(const char* buf, size_t size,
bool res = false;
Packet* packet = NextPacket(kTimeoutMs);
if (packet) {
- res = (packet->size == size && memcmp(packet->buf, buf, size) == 0);
+ int64_t packet_timestamp = packet->packet_time.timestamp;
+ res =
+ packet->size == size && memcmp(packet->buf, buf, size) == 0 &&
+ (prev_packet_timestamp_ == -1 ||
juberti2 2016/05/11 19:57:22 I think that -1 should only be allowed when we kno
stefan-webrtc 2016/05/12 11:19:53 We don't expect -1 to be returned on any platform
+ (packet_timestamp >= 0 && packet_timestamp >= prev_packet_timestamp_));
+ prev_packet_timestamp_ = packet_timestamp;
if (addr)
*addr = packet->addr;
delete packet;
@@ -122,21 +127,24 @@ void TestClient::OnPacket(AsyncPacketSocket* socket, const char* buf,
size_t size, const SocketAddress& remote_addr,
const PacketTime& packet_time) {
CritScope cs(&crit_);
- packets_->push_back(new Packet(remote_addr, buf, size));
+ packets_->push_back(new Packet(remote_addr, buf, size, packet_time));
}
void TestClient::OnReadyToSend(AsyncPacketSocket* socket) {
ready_to_send_ = true;
}
-TestClient::Packet::Packet(const SocketAddress& a, const char* b, size_t s)
- : addr(a), buf(0), size(s) {
+TestClient::Packet::Packet(const SocketAddress& a,
+ const char* b,
+ size_t s,
+ const PacketTime& packet_time)
+ : addr(a), buf(0), size(s), packet_time(packet_time) {
buf = new char[size];
memcpy(buf, b, size);
}
TestClient::Packet::Packet(const Packet& p)
- : addr(p.addr), buf(0), size(p.size) {
+ : addr(p.addr), buf(0), size(p.size), packet_time(p.packet_time) {
buf = new char[size];
memcpy(buf, p.buf, size);
}
« no previous file with comments | « webrtc/base/testclient.h ('k') | webrtc/base/testutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698