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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc

Issue 1467183002: Add new method AcmReceiver::last_packet_sample_rate_hz() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-last-output-rate
Patch Set: Updates after second review Created 5 years 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // Start with sending DTX. 323 // Start with sending DTX.
324 ASSERT_EQ(0, acm_->SetVAD(true, true, VADVeryAggr)); 324 ASSERT_EQ(0, acm_->SetVAD(true, true, VADVeryAggr));
325 packet_sent_ = false; 325 packet_sent_ = false;
326 InsertOnePacketOfSilence(CodecIdInst(kCodecId[0]).id); // Enough to test 326 InsertOnePacketOfSilence(CodecIdInst(kCodecId[0]).id); // Enough to test
327 // with one codec. 327 // with one codec.
328 ASSERT_TRUE(packet_sent_); 328 ASSERT_TRUE(packet_sent_);
329 EXPECT_EQ(kAudioFrameCN, last_frame_type_); 329 EXPECT_EQ(kAudioFrameCN, last_frame_type_);
330 330
331 // Has received, only, DTX. Last Audio codec is undefined. 331 // Has received, only, DTX. Last Audio codec is undefined.
332 EXPECT_EQ(-1, receiver_->LastAudioCodec(&codec)); 332 EXPECT_EQ(-1, receiver_->LastAudioCodec(&codec));
333 EXPECT_EQ(-1, receiver_->last_audio_codec_id()); 333 EXPECT_FALSE(receiver_->last_packet_sample_rate_hz());
334 334
335 for (auto id : kCodecId) { 335 for (auto id : kCodecId) {
336 const CodecIdInst c(id); 336 const CodecIdInst c(id);
337 337
338 // Set DTX off to send audio payload. 338 // Set DTX off to send audio payload.
339 acm_->SetVAD(false, false, VADAggr); 339 acm_->SetVAD(false, false, VADAggr);
340 packet_sent_ = false; 340 packet_sent_ = false;
341 InsertOnePacketOfSilence(c.id); 341 InsertOnePacketOfSilence(c.id);
342 342
343 // Sanity check if Actually an audio payload received, and it should be 343 // Sanity check if Actually an audio payload received, and it should be
344 // of type "speech." 344 // of type "speech."
345 ASSERT_TRUE(packet_sent_); 345 ASSERT_TRUE(packet_sent_);
346 ASSERT_EQ(kAudioFrameSpeech, last_frame_type_); 346 ASSERT_EQ(kAudioFrameSpeech, last_frame_type_);
347 EXPECT_EQ(c.id, receiver_->last_audio_codec_id()); 347 EXPECT_EQ(rtc::Optional<int>(c.inst.plfreq),
348 receiver_->last_packet_sample_rate_hz());
348 349
349 // Set VAD on to send DTX. Then check if the "Last Audio codec" returns 350 // Set VAD on to send DTX. Then check if the "Last Audio codec" returns
350 // the expected codec. 351 // the expected codec.
351 acm_->SetVAD(true, true, VADAggr); 352 acm_->SetVAD(true, true, VADAggr);
352 353
353 // Do as many encoding until a DTX is sent. 354 // Do as many encoding until a DTX is sent.
354 while (last_frame_type_ != kAudioFrameCN) { 355 while (last_frame_type_ != kAudioFrameCN) {
355 packet_sent_ = false; 356 packet_sent_ = false;
356 InsertOnePacketOfSilence(c.id); 357 InsertOnePacketOfSilence(c.id);
357 ASSERT_TRUE(packet_sent_); 358 ASSERT_TRUE(packet_sent_);
358 } 359 }
359 EXPECT_EQ(c.id, receiver_->last_audio_codec_id()); 360 EXPECT_EQ(rtc::Optional<int>(c.inst.plfreq),
361 receiver_->last_packet_sample_rate_hz());
360 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); 362 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec));
361 EXPECT_TRUE(CodecsEqual(c.inst, codec)); 363 EXPECT_TRUE(CodecsEqual(c.inst, codec));
362 } 364 }
363 } 365 }
364 366
365 } // namespace acm2 367 } // namespace acm2
366 368
367 } // namespace webrtc 369 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698