Delete unused PredictivePacketManipulator.
BUG=webrtc:8448 Change-Id: I07ff9db5cb49f84d98b6076e748a990aa560b5b5 Reviewed-on: https://webrtc-review.googlesource.com/15400 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20437}
This commit is contained in:
committed by
Commit Bot
parent
f7eea2a6bc
commit
fb6d32602c
@ -12,7 +12,6 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "modules/video_coding/codecs/test/predictive_packet_manipulator.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/unittest_utils.h"
|
||||
@ -93,56 +92,5 @@ TEST_F(PacketManipulatorTest, UniformDropAll) {
|
||||
packet_data_, image_);
|
||||
}
|
||||
|
||||
// Use our customized test class to make the second packet being lost
|
||||
TEST_F(PacketManipulatorTest, UniformDropSinglePacket) {
|
||||
drop_config_.packet_loss_probability = 0.5;
|
||||
PredictivePacketManipulator manipulator(&packet_reader_, drop_config_);
|
||||
manipulator.AddRandomResult(1.0);
|
||||
manipulator.AddRandomResult(0.3); // less than 0.5 will cause packet loss
|
||||
manipulator.AddRandomResult(1.0);
|
||||
|
||||
// Execute the test target method:
|
||||
int nbr_packets_dropped = manipulator.ManipulatePackets(&image_);
|
||||
|
||||
// Since we setup the predictive packet manipulator, it will throw away the
|
||||
// second packet. The third packet is also lost because when we have lost one,
|
||||
// the remains shall also be discarded (in the current implementation).
|
||||
VerifyPacketLoss(2, nbr_packets_dropped, kPacketSizeInBytes, packet1_,
|
||||
image_);
|
||||
}
|
||||
|
||||
// Use our customized test class to make the second packet being lost
|
||||
TEST_F(PacketManipulatorTest, BurstDropNinePackets) {
|
||||
// Create a longer packet data structure (10 packets)
|
||||
const int kNbrPackets = 10;
|
||||
const size_t kDataLength = kPacketSizeInBytes * kNbrPackets;
|
||||
uint8_t data[kDataLength];
|
||||
uint8_t* data_pointer = data;
|
||||
// Fill with 0s, 1s and so on to be able to easily verify which were dropped:
|
||||
for (int i = 0; i < kNbrPackets; ++i) {
|
||||
memset(data_pointer + i * kPacketSizeInBytes, i, kPacketSizeInBytes);
|
||||
}
|
||||
// Overwrite the defaults from the test fixture:
|
||||
image_._buffer = data;
|
||||
image_._length = kDataLength;
|
||||
image_._size = kDataLength;
|
||||
|
||||
drop_config_.packet_loss_probability = 0.5;
|
||||
drop_config_.packet_loss_burst_length = 5;
|
||||
drop_config_.packet_loss_mode = kBurst;
|
||||
PredictivePacketManipulator manipulator(&packet_reader_, drop_config_);
|
||||
manipulator.AddRandomResult(1.0);
|
||||
manipulator.AddRandomResult(0.3); // less than 0.5 will cause packet loss
|
||||
for (int i = 0; i < kNbrPackets - 2; ++i) {
|
||||
manipulator.AddRandomResult(1.0);
|
||||
}
|
||||
|
||||
// Execute the test target method:
|
||||
int nbr_packets_dropped = manipulator.ManipulatePackets(&image_);
|
||||
|
||||
// Should discard every packet after the first one.
|
||||
VerifyPacketLoss(9, nbr_packets_dropped, kPacketSizeInBytes, data, image_);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/codecs/test/predictive_packet_manipulator.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test/testsupport/packet_reader.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
PredictivePacketManipulator::PredictivePacketManipulator(
|
||||
PacketReader* packet_reader,
|
||||
const NetworkingConfig& config)
|
||||
: PacketManipulatorImpl(packet_reader, config, false) {}
|
||||
|
||||
PredictivePacketManipulator::~PredictivePacketManipulator() {}
|
||||
|
||||
void PredictivePacketManipulator::AddRandomResult(double result) {
|
||||
assert(result >= 0.0 && result <= 1.0);
|
||||
random_results_.push(result);
|
||||
}
|
||||
|
||||
double PredictivePacketManipulator::RandomUniform() {
|
||||
if (random_results_.size() == 0u) {
|
||||
fprintf(stderr,
|
||||
"No more stored results, please make sure AddRandomResult()"
|
||||
"is called same amount of times you're going to invoke the "
|
||||
"RandomUniform() function, i.e. once per packet.\n");
|
||||
assert(false);
|
||||
}
|
||||
double result = random_results_.front();
|
||||
random_results_.pop();
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_TEST_PREDICTIVE_PACKET_MANIPULATOR_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_TEST_PREDICTIVE_PACKET_MANIPULATOR_H_
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "modules/video_coding/codecs/test/packet_manipulator.h"
|
||||
#include "test/testsupport/packet_reader.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
// Predictive packet manipulator that allows for setup of the result of
|
||||
// the random invocations.
|
||||
class PredictivePacketManipulator : public PacketManipulatorImpl {
|
||||
public:
|
||||
PredictivePacketManipulator(PacketReader* packet_reader,
|
||||
const NetworkingConfig& config);
|
||||
virtual ~PredictivePacketManipulator();
|
||||
// Adds a result. You must add at least the same number of results as the
|
||||
// expected calls to the RandomUniform method. The results are added to a
|
||||
// FIFO queue so they will be returned in the same order they were added.
|
||||
// Result parameter must be 0.0 to 1.0.
|
||||
void AddRandomResult(double result);
|
||||
|
||||
protected:
|
||||
// Returns a uniformly distributed random value between 0.0 and 1.0
|
||||
double RandomUniform() override;
|
||||
|
||||
private:
|
||||
std::queue<double> random_results_;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_TEST_PREDICTIVE_PACKET_MANIPULATOR_H_
|
||||
Reference in New Issue
Block a user