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

Unified Diff: trunk/src/media/cast/test/utility/udp_proxy.cc

Issue 328313002: Revert 276603 "Cast: Synthetic benchmark tool." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 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: trunk/src/media/cast/test/utility/udp_proxy.cc
===================================================================
--- trunk/src/media/cast/test/utility/udp_proxy.cc (revision 276619)
+++ trunk/src/media/cast/test/utility/udp_proxy.cc (working copy)
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdlib.h>
-
#include "media/cast/test/utility/udp_proxy.h"
#include "base/logging.h"
@@ -50,10 +48,7 @@
: buffer_size_(0),
max_buffer_size_(buffer_size),
max_megabits_per_second_(max_megabits_per_second),
- weak_factory_(this) {
- CHECK_GT(max_buffer_size_, 0UL);
- CHECK_GT(max_megabits_per_second, 0);
- }
+ weak_factory_(this) {}
virtual void Send(scoped_ptr<transport::Packet> packet) OVERRIDE {
if (packet->size() + buffer_size_ <= max_buffer_size_) {
@@ -100,17 +95,17 @@
class RandomDrop : public PacketPipe {
public:
- RandomDrop(double drop_fraction)
- : drop_fraction_(static_cast<int>(drop_fraction * RAND_MAX)) {}
+ RandomDrop(double drop_fraction) : drop_fraction_(drop_fraction) {
+ }
virtual void Send(scoped_ptr<transport::Packet> packet) OVERRIDE {
- if (rand() > drop_fraction_) {
+ if (base::RandDouble() >= drop_fraction_) {
pipe_->Send(packet.Pass());
}
}
private:
- int drop_fraction_;
+ double drop_fraction_;
};
scoped_ptr<PacketPipe> NewRandomDrop(double drop_fraction) {
« no previous file with comments | « trunk/src/media/cast/test/utility/test_util.cc ('k') | trunk/src/media/cast/video_sender/fake_software_video_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698