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

Unified Diff: webrtc/modules/audio_coding/main/acm2/acm_receive_test.cc

Issue 1415163002: Removing AudioCoding class, a.k.a the new ACM API (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/main/acm2/acm_receive_test.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receive_test.cc b/webrtc/modules/audio_coding/main/acm2/acm_receive_test.cc
deleted file mode 100644
index 85678cf2209ba22e757be1fe8dcee1eebfc9fe90..0000000000000000000000000000000000000000
--- a/webrtc/modules/audio_coding/main/acm2/acm_receive_test.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2014 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 "webrtc/modules/audio_coding/main/acm2/acm_receive_test.h"
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
-#include "webrtc/modules/audio_coding/neteq/tools/audio_sink.h"
-#include "webrtc/modules/audio_coding/neteq/tools/packet.h"
-#include "webrtc/modules/audio_coding/neteq/tools/packet_source.h"
-
-namespace webrtc {
-namespace test {
-
-AcmReceiveTest::AcmReceiveTest(PacketSource* packet_source,
- AudioSink* audio_sink,
- int output_freq_hz,
- NumOutputChannels expected_output_channels)
- : clock_(0),
- packet_source_(packet_source),
- audio_sink_(audio_sink),
- output_freq_hz_(output_freq_hz),
- expected_output_channels_(expected_output_channels) {
- webrtc::AudioCoding::Config config;
- config.clock = &clock_;
- config.playout_frequency_hz = output_freq_hz_;
- acm_.reset(webrtc::AudioCoding::Create(config));
-}
-
-void AcmReceiveTest::RegisterDefaultCodecs() {
-#ifdef WEBRTC_CODEC_OPUS
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kOpus, 120));
-#endif
-#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISAC, 103));
-#endif
-#ifdef WEBRTC_CODEC_ISAC
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISACSWB, 104));
-#endif
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16B, 107));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16Bwb, 108));
- ASSERT_TRUE(
- acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16Bswb32kHz, 109));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16B_2ch, 111));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16Bwb_2ch, 112));
- ASSERT_TRUE(
- acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16Bswb32kHz_2ch, 113));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMU, 0));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMA, 8));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMU_2ch, 110));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMA_2ch, 118));
-#ifdef WEBRTC_CODEC_ILBC
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kILBC, 102));
-#endif
-#ifdef WEBRTC_CODEC_G722
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kG722, 9));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kG722_2ch, 119));
-#endif
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNNB, 13));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNWB, 98));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNSWB, 99));
-#ifdef WEBRTC_CODEC_RED
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kRED, 127));
-#endif
-}
-
-void AcmReceiveTest::RegisterNetEqTestCodecs() {
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISAC, 103));
-#ifndef WEBRTC_ANDROID
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kISACSWB, 104));
-#endif
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16B, 93));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16Bwb, 94));
- ASSERT_TRUE(
- acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCM16Bswb32kHz, 95));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMU, 0));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kPCMA, 8));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kILBC, 102));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kG722, 9));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNNB, 13));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNWB, 98));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kCNSWB, 99));
- ASSERT_TRUE(acm_->RegisterReceiveCodec(acm2::ACMCodecDB::kRED, 117));
-}
-
-void AcmReceiveTest::Run() {
- for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet;
- packet.reset(packet_source_->NextPacket())) {
- // Pull audio until time to insert packet.
- while (clock_.TimeInMilliseconds() < packet->time_ms()) {
- AudioFrame output_frame;
- EXPECT_TRUE(acm_->Get10MsAudio(&output_frame));
- EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_);
- const size_t samples_per_block =
- static_cast<size_t>(output_freq_hz_ * 10 / 1000);
- EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_);
- if (expected_output_channels_ != kArbitraryChannels) {
- if (output_frame.speech_type_ == webrtc::AudioFrame::kPLC) {
- // Don't check number of channels for PLC output, since each test run
- // usually starts with a short period of mono PLC before decoding the
- // first packet.
- } else {
- EXPECT_EQ(expected_output_channels_, output_frame.num_channels_);
- }
- }
- ASSERT_TRUE(audio_sink_->WriteAudioFrame(output_frame));
- clock_.AdvanceTimeMilliseconds(10);
- }
-
- // Insert packet after converting from RTPHeader to WebRtcRTPHeader.
- WebRtcRTPHeader header;
- header.header = packet->header();
- header.frameType = kAudioFrameSpeech;
- memset(&header.type.Audio, 0, sizeof(RTPAudioHeader));
- EXPECT_TRUE(acm_->InsertPacket(packet->payload(),
- packet->payload_length_bytes(),
- header))
- << "Failure when inserting packet:" << std::endl
- << " PT = " << static_cast<int>(header.header.payloadType) << std::endl
- << " TS = " << header.header.timestamp << std::endl
- << " SN = " << header.header.sequenceNumber;
- }
-}
-
-} // namespace test
-} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698