| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/video_coding/codecs/test/predictive_packet_manipulator.
h" | 11 #include "webrtc/modules/video_coding/codecs/test/predictive_packet_manipulator.
h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 | 15 |
| 16 #include "webrtc/test/testsupport/packet_reader.h" | 16 #include "webrtc/test/testsupport/packet_reader.h" |
| 17 | 17 |
| 18 namespace webrtc { | 18 namespace webrtc { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 PredictivePacketManipulator::PredictivePacketManipulator( | 21 PredictivePacketManipulator::PredictivePacketManipulator( |
| 22 PacketReader* packet_reader, const NetworkingConfig& config) | 22 PacketReader* packet_reader, |
| 23 : PacketManipulatorImpl(packet_reader, config, false) { | 23 const NetworkingConfig& config) |
| 24 } | 24 : PacketManipulatorImpl(packet_reader, config, false) {} |
| 25 | 25 |
| 26 PredictivePacketManipulator::~PredictivePacketManipulator() { | 26 PredictivePacketManipulator::~PredictivePacketManipulator() {} |
| 27 } | |
| 28 | |
| 29 | 27 |
| 30 void PredictivePacketManipulator::AddRandomResult(double result) { | 28 void PredictivePacketManipulator::AddRandomResult(double result) { |
| 31 assert(result >= 0.0 && result <= 1.0); | 29 assert(result >= 0.0 && result <= 1.0); |
| 32 random_results_.push(result); | 30 random_results_.push(result); |
| 33 } | 31 } |
| 34 | 32 |
| 35 double PredictivePacketManipulator::RandomUniform() { | 33 double PredictivePacketManipulator::RandomUniform() { |
| 36 if(random_results_.size() == 0u) { | 34 if (random_results_.size() == 0u) { |
| 37 fprintf(stderr, "No more stored results, please make sure AddRandomResult()" | 35 fprintf(stderr, |
| 36 "No more stored results, please make sure AddRandomResult()" |
| 38 "is called same amount of times you're going to invoke the " | 37 "is called same amount of times you're going to invoke the " |
| 39 "RandomUniform() function, i.e. once per packet.\n"); | 38 "RandomUniform() function, i.e. once per packet.\n"); |
| 40 assert(false); | 39 assert(false); |
| 41 } | 40 } |
| 42 double result = random_results_.front(); | 41 double result = random_results_.front(); |
| 43 random_results_.pop(); | 42 random_results_.pop(); |
| 44 return result; | 43 return result; |
| 45 } | 44 } |
| 46 | 45 |
| 47 } // namespace test | 46 } // namespace test |
| 48 } // namespace webrtcc | 47 } // namespace webrtc |
| OLD | NEW |