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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 2005873002: Let PacketSource::NextPacket() return an std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (rtp_header.header.payloadType != 104) 342 if (rtp_header.header.payloadType != 104)
343 #endif 343 #endif
344 ASSERT_EQ(0, neteq_->InsertPacket( 344 ASSERT_EQ(0, neteq_->InsertPacket(
345 rtp_header, 345 rtp_header,
346 rtc::ArrayView<const uint8_t>( 346 rtc::ArrayView<const uint8_t>(
347 packet_->payload(), packet_->payload_length_bytes()), 347 packet_->payload(), packet_->payload_length_bytes()),
348 static_cast<uint32_t>(packet_->time_ms() * 348 static_cast<uint32_t>(packet_->time_ms() *
349 (output_sample_rate_ / 1000)))); 349 (output_sample_rate_ / 1000))));
350 } 350 }
351 // Get next packet. 351 // Get next packet.
352 packet_.reset(rtp_source_->NextPacket()); 352 packet_ = rtp_source_->NextPacket();
353 } 353 }
354 354
355 // Get audio from NetEq. 355 // Get audio from NetEq.
356 bool muted; 356 bool muted;
357 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 357 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
358 ASSERT_FALSE(muted); 358 ASSERT_FALSE(muted);
359 ASSERT_TRUE((out_frame_.samples_per_channel_ == kBlockSize8kHz) || 359 ASSERT_TRUE((out_frame_.samples_per_channel_ == kBlockSize8kHz) ||
360 (out_frame_.samples_per_channel_ == kBlockSize16kHz) || 360 (out_frame_.samples_per_channel_ == kBlockSize16kHz) ||
361 (out_frame_.samples_per_channel_ == kBlockSize32kHz) || 361 (out_frame_.samples_per_channel_ == kBlockSize32kHz) ||
362 (out_frame_.samples_per_channel_ == kBlockSize48kHz)); 362 (out_frame_.samples_per_channel_ == kBlockSize48kHz));
(...skipping 17 matching lines...) Expand all
380 ResultSink output(ref_out_file); 380 ResultSink output(ref_out_file);
381 381
382 std::string stat_out_file = 382 std::string stat_out_file =
383 gen_ref ? webrtc::test::OutputPath() + "neteq_network_stats.dat" : ""; 383 gen_ref ? webrtc::test::OutputPath() + "neteq_network_stats.dat" : "";
384 ResultSink network_stats(stat_out_file); 384 ResultSink network_stats(stat_out_file);
385 385
386 std::string rtcp_out_file = 386 std::string rtcp_out_file =
387 gen_ref ? webrtc::test::OutputPath() + "neteq_rtcp_stats.dat" : ""; 387 gen_ref ? webrtc::test::OutputPath() + "neteq_rtcp_stats.dat" : "";
388 ResultSink rtcp_stats(rtcp_out_file); 388 ResultSink rtcp_stats(rtcp_out_file);
389 389
390 packet_.reset(rtp_source_->NextPacket()); 390 packet_ = rtp_source_->NextPacket();
391 int i = 0; 391 int i = 0;
392 while (packet_) { 392 while (packet_) {
393 std::ostringstream ss; 393 std::ostringstream ss;
394 ss << "Lap number " << i++ << " in DecodeAndCompare while loop"; 394 ss << "Lap number " << i++ << " in DecodeAndCompare while loop";
395 SCOPED_TRACE(ss.str()); // Print out the parameter values on failure. 395 SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
396 ASSERT_NO_FATAL_FAILURE(Process()); 396 ASSERT_NO_FATAL_FAILURE(Process());
397 ASSERT_NO_FATAL_FAILURE(output.AddResult( 397 ASSERT_NO_FATAL_FAILURE(output.AddResult(
398 out_frame_.data_, out_frame_.samples_per_channel_)); 398 out_frame_.data_, out_frame_.samples_per_channel_));
399 399
400 // Query the network statistics API once per second 400 // Query the network statistics API once per second
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 if (muted) { 1769 if (muted) {
1770 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); 1770 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2));
1771 } else { 1771 } else {
1772 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); 1772 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2));
1773 } 1773 }
1774 } 1774 }
1775 EXPECT_FALSE(muted); 1775 EXPECT_FALSE(muted);
1776 } 1776 }
1777 1777
1778 } // namespace webrtc 1778 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698