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

Unified Diff: webrtc/audio/test/audio_end_to_end_test.cc

Issue 3008273002: Replace voe_conference_test. (Closed)
Patch Set: rebase Created 3 years, 3 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
« no previous file with comments | « webrtc/audio/test/audio_end_to_end_test.h ('k') | webrtc/audio/test/audio_stats_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/audio/test/audio_end_to_end_test.cc
diff --git a/webrtc/audio/test/audio_end_to_end_test.cc b/webrtc/audio/test/audio_end_to_end_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5d4cbf024a4f5e0cf25146cd8ebaa198225211d9
--- /dev/null
+++ b/webrtc/audio/test/audio_end_to_end_test.cc
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2017 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 <algorithm>
+
+#include "webrtc/audio/test/audio_end_to_end_test.h"
+#include "webrtc/system_wrappers/include/sleep.h"
+#include "webrtc/test/fake_audio_device.h"
+#include "webrtc/test/gtest.h"
+
+namespace webrtc {
+namespace test {
+namespace {
+// Wait half a second between stopping sending and stopping receiving audio.
+constexpr int kExtraRecordTimeMs = 500;
+
+constexpr int kSampleRate = 48000;
+} // namespace
+
+AudioEndToEndTest::AudioEndToEndTest()
+ : EndToEndTest(CallTest::kDefaultTimeoutMs) {}
+
+FakeNetworkPipe::Config AudioEndToEndTest::GetNetworkPipeConfig() const {
+ return FakeNetworkPipe::Config();
+}
+
+size_t AudioEndToEndTest::GetNumVideoStreams() const {
+ return 0;
+}
+
+size_t AudioEndToEndTest::GetNumAudioStreams() const {
+ return 1;
+}
+
+size_t AudioEndToEndTest::GetNumFlexfecStreams() const {
+ return 0;
+}
+
+std::unique_ptr<test::FakeAudioDevice::Capturer>
+ AudioEndToEndTest::CreateCapturer() {
+ return test::FakeAudioDevice::CreatePulsedNoiseCapturer(32000, kSampleRate);
+}
+
+std::unique_ptr<test::FakeAudioDevice::Renderer>
+ AudioEndToEndTest::CreateRenderer() {
+ return test::FakeAudioDevice::CreateDiscardRenderer(kSampleRate);
+}
+
+void AudioEndToEndTest::OnFakeAudioDevicesCreated(
+ test::FakeAudioDevice* send_audio_device,
+ test::FakeAudioDevice* recv_audio_device) {
+ send_audio_device_ = send_audio_device;
+}
+
+test::PacketTransport* AudioEndToEndTest::CreateSendTransport(
+ SingleThreadedTaskQueueForTesting* task_queue,
+ Call* sender_call) {
+ return new test::PacketTransport(
+ task_queue, sender_call, this, test::PacketTransport::kSender,
+ test::CallTest::payload_type_map_, GetNetworkPipeConfig());
+}
+
+test::PacketTransport* AudioEndToEndTest::CreateReceiveTransport(
+ SingleThreadedTaskQueueForTesting* task_queue) {
+ return new test::PacketTransport(
+ task_queue, nullptr, this, test::PacketTransport::kReceiver,
+ test::CallTest::payload_type_map_, GetNetworkPipeConfig());
+}
+
+void AudioEndToEndTest::ModifyAudioConfigs(
+ AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStream::Config>* receive_configs) {
+ // Large bitrate by default.
+ const webrtc::SdpAudioFormat kDefaultFormat("opus", 48000, 2,
+ {{"stereo", "1"}});
+ send_config->send_codec_spec =
+ rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
+ {test::CallTest::kAudioSendPayloadType, kDefaultFormat});
+}
+
+void AudioEndToEndTest::OnAudioStreamsCreated(
+ AudioSendStream* send_stream,
+ const std::vector<AudioReceiveStream*>& receive_streams) {
+ ASSERT_NE(nullptr, send_stream);
+ ASSERT_EQ(1u, receive_streams.size());
+ ASSERT_NE(nullptr, receive_streams[0]);
+ send_stream_ = send_stream;
+ receive_stream_ = receive_streams[0];
+}
+
+void AudioEndToEndTest::PerformTest() {
+ // Wait until the input audio file is done...
+ send_audio_device_->WaitForRecordingEnd();
+ // and some extra time to account for network delay.
+ SleepMs(GetNetworkPipeConfig().queue_delay_ms + kExtraRecordTimeMs);
+}
+} // namespace test
+} // namespace webrtc
« no previous file with comments | « webrtc/audio/test/audio_end_to_end_test.h ('k') | webrtc/audio/test/audio_stats_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698