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

Side by Side Diff: webrtc/test/call_test.cc

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Created 3 years, 10 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
11 #include "webrtc/test/call_test.h" 11 #include "webrtc/test/call_test.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" 15 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/config.h" 17 #include "webrtc/config.h"
18 #include "webrtc/modules/audio_coding/codecs/builtin_audio_encoder_factory.h"
18 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" 19 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
19 #include "webrtc/test/testsupport/fileutils.h" 20 #include "webrtc/test/testsupport/fileutils.h"
20 #include "webrtc/voice_engine/include/voe_base.h" 21 #include "webrtc/voice_engine/include/voe_base.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 namespace test { 24 namespace test {
24 25
25 namespace { 26 namespace {
26 const int kVideoRotationRtpExtensionId = 4; 27 const int kVideoRotationRtpExtensionId = 4;
27 } 28 }
28 29
29 CallTest::CallTest() 30 CallTest::CallTest()
30 : clock_(Clock::GetRealTimeClock()), 31 : clock_(Clock::GetRealTimeClock()),
31 video_send_config_(nullptr), 32 video_send_config_(nullptr),
32 video_send_stream_(nullptr), 33 video_send_stream_(nullptr),
33 audio_send_config_(nullptr), 34 audio_send_config_(nullptr),
34 audio_send_stream_(nullptr), 35 audio_send_stream_(nullptr),
35 fake_encoder_(clock_), 36 fake_encoder_(clock_),
36 num_video_streams_(1), 37 num_video_streams_(1),
37 num_audio_streams_(0), 38 num_audio_streams_(0),
38 num_flexfec_streams_(0), 39 num_flexfec_streams_(0),
39 decoder_factory_(CreateBuiltinAudioDecoderFactory()), 40 decoder_factory_(CreateBuiltinAudioDecoderFactory()),
41 encoder_factory_(CreateBuiltinAudioEncoderFactory()),
40 fake_send_audio_device_(nullptr), 42 fake_send_audio_device_(nullptr),
41 fake_recv_audio_device_(nullptr) {} 43 fake_recv_audio_device_(nullptr) {}
42 44
43 CallTest::~CallTest() { 45 CallTest::~CallTest() {
44 } 46 }
45 47
46 void CallTest::RunBaseTest(BaseTest* test) { 48 void CallTest::RunBaseTest(BaseTest* test) {
47 num_video_streams_ = test->GetNumVideoStreams(); 49 num_video_streams_ = test->GetNumVideoStreams();
48 num_audio_streams_ = test->GetNumAudioStreams(); 50 num_audio_streams_ = test->GetNumAudioStreams();
49 num_flexfec_streams_ = test->GetNumFlexfecStreams(); 51 num_flexfec_streams_ = test->GetNumFlexfecStreams();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 for (size_t i = 0; i < num_video_streams; ++i) 209 for (size_t i = 0; i < num_video_streams; ++i)
208 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]); 210 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]);
209 video_send_config_.rtp.extensions.push_back(RtpExtension( 211 video_send_config_.rtp.extensions.push_back(RtpExtension(
210 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId)); 212 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId));
211 } 213 }
212 214
213 if (num_audio_streams > 0) { 215 if (num_audio_streams > 0) {
214 audio_send_config_ = AudioSendStream::Config(send_transport); 216 audio_send_config_ = AudioSendStream::Config(send_transport);
215 audio_send_config_.voe_channel_id = voe_send_.channel_id; 217 audio_send_config_.voe_channel_id = voe_send_.channel_id;
216 audio_send_config_.rtp.ssrc = kAudioSendSsrc; 218 audio_send_config_.rtp.ssrc = kAudioSendSsrc;
217 audio_send_config_.send_codec_spec.codec_inst = 219 audio_send_config_.send_codec_spec.payload_type = kAudioSendPayloadType;
218 CodecInst{kAudioSendPayloadType, "ISAC", 16000, 480, 1, 32000}; 220 audio_send_config_.send_codec_spec.format.format = {"ISAC", 16000, 1};
221 audio_send_config_.encoder_factory = encoder_factory_;
219 } 222 }
220 223
221 // TODO(brandtr): Update this when we support multistream protection. 224 // TODO(brandtr): Update this when we support multistream protection.
222 if (num_flexfec_streams > 0) { 225 if (num_flexfec_streams > 0) {
223 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType; 226 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType;
224 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc; 227 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc;
225 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]}; 228 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]};
226 } 229 }
227 } 230 }
228 231
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 498
496 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 499 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
497 } 500 }
498 501
499 bool EndToEndTest::ShouldCreateReceivers() const { 502 bool EndToEndTest::ShouldCreateReceivers() const {
500 return true; 503 return true;
501 } 504 }
502 505
503 } // namespace test 506 } // namespace test
504 } // namespace webrtc 507 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698