| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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/audio_coding/test/PacketLossTest.h" | 11 #include "webrtc/modules/audio_coding/test/PacketLossTest.h" |
| 12 | 12 |
| 13 #include <memory> |
| 14 |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "webrtc/common.h" | 16 #include "webrtc/common.h" |
| 15 #include "webrtc/test/testsupport/fileutils.h" | 17 #include "webrtc/test/testsupport/fileutils.h" |
| 16 | 18 |
| 17 namespace webrtc { | 19 namespace webrtc { |
| 18 | 20 |
| 19 ReceiverWithPacketLoss::ReceiverWithPacketLoss() | 21 ReceiverWithPacketLoss::ReceiverWithPacketLoss() |
| 20 : loss_rate_(0), | 22 : loss_rate_(0), |
| 21 burst_length_(1), | 23 burst_length_(1), |
| 22 packet_counter_(0), | 24 packet_counter_(0), |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 receiver_(new ReceiverWithPacketLoss), | 121 receiver_(new ReceiverWithPacketLoss), |
| 120 expected_loss_rate_(expected_loss_rate), | 122 expected_loss_rate_(expected_loss_rate), |
| 121 actual_loss_rate_(actual_loss_rate), | 123 actual_loss_rate_(actual_loss_rate), |
| 122 burst_length_(burst_length) { | 124 burst_length_(burst_length) { |
| 123 } | 125 } |
| 124 | 126 |
| 125 void PacketLossTest::Perform() { | 127 void PacketLossTest::Perform() { |
| 126 #ifndef WEBRTC_CODEC_OPUS | 128 #ifndef WEBRTC_CODEC_OPUS |
| 127 return; | 129 return; |
| 128 #else | 130 #else |
| 129 rtc::scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0)); | 131 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0)); |
| 130 | 132 |
| 131 int codec_id = acm->Codec("opus", 48000, channels_); | 133 int codec_id = acm->Codec("opus", 48000, channels_); |
| 132 | 134 |
| 133 RTPFile rtpFile; | 135 RTPFile rtpFile; |
| 134 std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(), | 136 std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(), |
| 135 "packet_loss_test"); | 137 "packet_loss_test"); |
| 136 | 138 |
| 137 // Encode to file | 139 // Encode to file |
| 138 rtpFile.Open(fileName.c_str(), "wb+"); | 140 rtpFile.Open(fileName.c_str(), "wb+"); |
| 139 rtpFile.WriteHeader(); | 141 rtpFile.WriteHeader(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 158 | 160 |
| 159 receiver_->Setup(acm.get(), &rtpFile, "packetLoss_out", channels_, | 161 receiver_->Setup(acm.get(), &rtpFile, "packetLoss_out", channels_, |
| 160 actual_loss_rate_, burst_length_); | 162 actual_loss_rate_, burst_length_); |
| 161 receiver_->Run(); | 163 receiver_->Run(); |
| 162 receiver_->Teardown(); | 164 receiver_->Teardown(); |
| 163 rtpFile.Close(); | 165 rtpFile.Close(); |
| 164 #endif | 166 #endif |
| 165 } | 167 } |
| 166 | 168 |
| 167 } // namespace webrtc | 169 } // namespace webrtc |
| OLD | NEW |