1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_PREDICTIVE_PACKET_MANIPULATOR_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_PREDICTIVE_PACKET_MANIPULATOR_H_ 13 14 #include <queue> 15 16 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" 17 #include "webrtc/test/testsupport/packet_reader.h" 18 19 namespace webrtc { 20 namespace test { 21 22 // Predictive packet manipulator that allows for setup of the result of 23 // the random invocations. 24 class PredictivePacketManipulator : public PacketManipulatorImpl { 25 public: 26 PredictivePacketManipulator(PacketReader* packet_reader, 27 const NetworkingConfig& config); 28 virtual ~PredictivePacketManipulator(); 29 // Adds a result. You must add at least the same number of results as the 30 // expected calls to the RandomUniform method. The results are added to a 31 // FIFO queue so they will be returned in the same order they were added. 32 // Result parameter must be 0.0 to 1.0. 33 void AddRandomResult(double result); 34 35 protected: 36 // Returns a uniformly distributed random value between 0.0 and 1.0 37 double RandomUniform() override; 38 39 private: 40 std::queue<double> random_results_; 41 }; 42 43 } // namespace test 44 } // namespace webrtc 45 46 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_PREDICTIVE_PACKET_MANIPULATOR_H_ 47