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

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

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Channel::GetSendCodec asks both its acm and its codec manager. Created 3 years, 8 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 event_log_(RtcEventLog::CreateNull()), 32 event_log_(RtcEventLog::CreateNull()),
32 video_send_config_(nullptr), 33 video_send_config_(nullptr),
33 video_send_stream_(nullptr), 34 video_send_stream_(nullptr),
34 audio_send_config_(nullptr), 35 audio_send_config_(nullptr),
35 audio_send_stream_(nullptr), 36 audio_send_stream_(nullptr),
36 fake_encoder_(clock_), 37 fake_encoder_(clock_),
37 num_video_streams_(1), 38 num_video_streams_(1),
38 num_audio_streams_(0), 39 num_audio_streams_(0),
39 num_flexfec_streams_(0), 40 num_flexfec_streams_(0),
40 decoder_factory_(CreateBuiltinAudioDecoderFactory()), 41 decoder_factory_(CreateBuiltinAudioDecoderFactory()),
42 encoder_factory_(CreateBuiltinAudioEncoderFactory()),
41 fake_send_audio_device_(nullptr), 43 fake_send_audio_device_(nullptr),
42 fake_recv_audio_device_(nullptr) {} 44 fake_recv_audio_device_(nullptr) {}
43 45
44 CallTest::~CallTest() { 46 CallTest::~CallTest() {
45 } 47 }
46 48
47 void CallTest::RunBaseTest(BaseTest* test) { 49 void CallTest::RunBaseTest(BaseTest* test) {
48 num_video_streams_ = test->GetNumVideoStreams(); 50 num_video_streams_ = test->GetNumVideoStreams();
49 num_audio_streams_ = test->GetNumAudioStreams(); 51 num_audio_streams_ = test->GetNumAudioStreams();
50 num_flexfec_streams_ = test->GetNumFlexfecStreams(); 52 num_flexfec_streams_ = test->GetNumFlexfecStreams();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 for (size_t i = 0; i < num_video_streams; ++i) 217 for (size_t i = 0; i < num_video_streams; ++i)
216 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]); 218 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]);
217 video_send_config_.rtp.extensions.push_back(RtpExtension( 219 video_send_config_.rtp.extensions.push_back(RtpExtension(
218 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId)); 220 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId));
219 } 221 }
220 222
221 if (num_audio_streams > 0) { 223 if (num_audio_streams > 0) {
222 audio_send_config_ = AudioSendStream::Config(send_transport); 224 audio_send_config_ = AudioSendStream::Config(send_transport);
223 audio_send_config_.voe_channel_id = voe_send_.channel_id; 225 audio_send_config_.voe_channel_id = voe_send_.channel_id;
224 audio_send_config_.rtp.ssrc = kAudioSendSsrc; 226 audio_send_config_.rtp.ssrc = kAudioSendSsrc;
225 audio_send_config_.send_codec_spec.codec_inst = 227 audio_send_config_.send_codec_spec =
226 CodecInst{kAudioSendPayloadType, "OPUS", 48000, 960, 2, 64000}; 228 rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
229 {kAudioSendPayloadType, {"OPUS", 48000, 2, {{"stereo", "1"}}}});
230 audio_send_config_.encoder_factory = encoder_factory_;
227 } 231 }
228 232
229 // TODO(brandtr): Update this when we support multistream protection. 233 // TODO(brandtr): Update this when we support multistream protection.
230 if (num_flexfec_streams > 0) { 234 if (num_flexfec_streams > 0) {
231 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType; 235 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType;
232 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc; 236 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc;
233 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]}; 237 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]};
234 } 238 }
235 } 239 }
236 240
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 543
540 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 544 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
541 } 545 }
542 546
543 bool EndToEndTest::ShouldCreateReceivers() const { 547 bool EndToEndTest::ShouldCreateReceivers() const {
544 return true; 548 return true;
545 } 549 }
546 550
547 } // namespace test 551 } // namespace test
548 } // namespace webrtc 552 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698