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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include <algorithm>
12
13 #include "webrtc/audio/test/audio_end_to_end_test.h"
14 #include "webrtc/system_wrappers/include/sleep.h"
15 #include "webrtc/test/fake_audio_device.h"
16 #include "webrtc/test/gtest.h"
17
18 namespace webrtc {
19 namespace test {
20 namespace {
21 // Wait half a second between stopping sending and stopping receiving audio.
22 constexpr int kExtraRecordTimeMs = 500;
23
24 constexpr int kSampleRate = 48000;
25 } // namespace
26
27 AudioEndToEndTest::AudioEndToEndTest()
28 : EndToEndTest(CallTest::kDefaultTimeoutMs) {}
29
30 FakeNetworkPipe::Config AudioEndToEndTest::GetNetworkPipeConfig() const {
31 return FakeNetworkPipe::Config();
32 }
33
34 size_t AudioEndToEndTest::GetNumVideoStreams() const {
35 return 0;
36 }
37
38 size_t AudioEndToEndTest::GetNumAudioStreams() const {
39 return 1;
40 }
41
42 size_t AudioEndToEndTest::GetNumFlexfecStreams() const {
43 return 0;
44 }
45
46 std::unique_ptr<test::FakeAudioDevice::Capturer>
47 AudioEndToEndTest::CreateCapturer() {
48 return test::FakeAudioDevice::CreatePulsedNoiseCapturer(32000, kSampleRate);
49 }
50
51 std::unique_ptr<test::FakeAudioDevice::Renderer>
52 AudioEndToEndTest::CreateRenderer() {
53 return test::FakeAudioDevice::CreateDiscardRenderer(kSampleRate);
54 }
55
56 void AudioEndToEndTest::OnFakeAudioDevicesCreated(
57 test::FakeAudioDevice* send_audio_device,
58 test::FakeAudioDevice* recv_audio_device) {
59 send_audio_device_ = send_audio_device;
60 }
61
62 test::PacketTransport* AudioEndToEndTest::CreateSendTransport(
63 SingleThreadedTaskQueueForTesting* task_queue,
64 Call* sender_call) {
65 return new test::PacketTransport(
66 task_queue, sender_call, this, test::PacketTransport::kSender,
67 test::CallTest::payload_type_map_, GetNetworkPipeConfig());
68 }
69
70 test::PacketTransport* AudioEndToEndTest::CreateReceiveTransport(
71 SingleThreadedTaskQueueForTesting* task_queue) {
72 return new test::PacketTransport(
73 task_queue, nullptr, this, test::PacketTransport::kReceiver,
74 test::CallTest::payload_type_map_, GetNetworkPipeConfig());
75 }
76
77 void AudioEndToEndTest::ModifyAudioConfigs(
78 AudioSendStream::Config* send_config,
79 std::vector<AudioReceiveStream::Config>* receive_configs) {
80 // Large bitrate by default.
81 const webrtc::SdpAudioFormat kDefaultFormat("opus", 48000, 2,
82 {{"stereo", "1"}});
83 send_config->send_codec_spec =
84 rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
85 {test::CallTest::kAudioSendPayloadType, kDefaultFormat});
86 }
87
88 void AudioEndToEndTest::OnAudioStreamsCreated(
89 AudioSendStream* send_stream,
90 const std::vector<AudioReceiveStream*>& receive_streams) {
91 ASSERT_NE(nullptr, send_stream);
92 ASSERT_EQ(1u, receive_streams.size());
93 ASSERT_NE(nullptr, receive_streams[0]);
94 send_stream_ = send_stream;
95 receive_stream_ = receive_streams[0];
96 }
97
98 void AudioEndToEndTest::PerformTest() {
99 // Wait until the input audio file is done...
100 send_audio_device_->WaitForRecordingEnd();
101 // and some extra time to account for network delay.
102 SleepMs(GetNetworkPipeConfig().queue_delay_ms + kExtraRecordTimeMs);
103 }
104 } // namespace test
105 } // namespace webrtc
OLDNEW
« 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