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

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

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Moved duplicated configuration from constructor to ConfigureStream (previously Reconfigure) 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 }
(...skipping 25 matching lines...) Expand all
53 : clock_(Clock::GetRealTimeClock()), 54 : clock_(Clock::GetRealTimeClock()),
54 video_send_config_(nullptr), 55 video_send_config_(nullptr),
55 video_send_stream_(nullptr), 56 video_send_stream_(nullptr),
56 audio_send_config_(nullptr), 57 audio_send_config_(nullptr),
57 audio_send_stream_(nullptr), 58 audio_send_stream_(nullptr),
58 fake_encoder_(clock_), 59 fake_encoder_(clock_),
59 num_video_streams_(1), 60 num_video_streams_(1),
60 num_audio_streams_(0), 61 num_audio_streams_(0),
61 num_flexfec_streams_(0), 62 num_flexfec_streams_(0),
62 decoder_factory_(CreateBuiltinAudioDecoderFactory()), 63 decoder_factory_(CreateBuiltinAudioDecoderFactory()),
64 encoder_factory_(CreateBuiltinAudioEncoderFactory()),
63 fake_send_audio_device_(nullptr), 65 fake_send_audio_device_(nullptr),
64 fake_recv_audio_device_(nullptr) {} 66 fake_recv_audio_device_(nullptr) {}
65 67
66 CallTest::~CallTest() { 68 CallTest::~CallTest() {
67 } 69 }
68 70
69 void CallTest::RunBaseTest(BaseTest* test) { 71 void CallTest::RunBaseTest(BaseTest* test) {
70 num_video_streams_ = test->GetNumVideoStreams(); 72 num_video_streams_ = test->GetNumVideoStreams();
71 num_audio_streams_ = test->GetNumAudioStreams(); 73 num_audio_streams_ = test->GetNumAudioStreams();
72 num_flexfec_streams_ = test->GetNumFlexfecStreams(); 74 num_flexfec_streams_ = test->GetNumFlexfecStreams();
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 for (size_t i = 0; i < num_video_streams; ++i) 249 for (size_t i = 0; i < num_video_streams; ++i)
248 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]); 250 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]);
249 video_send_config_.rtp.extensions.push_back(RtpExtension( 251 video_send_config_.rtp.extensions.push_back(RtpExtension(
250 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId)); 252 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId));
251 } 253 }
252 254
253 if (num_audio_streams > 0) { 255 if (num_audio_streams > 0) {
254 audio_send_config_ = AudioSendStream::Config(send_transport); 256 audio_send_config_ = AudioSendStream::Config(send_transport);
255 audio_send_config_.voe_channel_id = voe_send_.channel_id; 257 audio_send_config_.voe_channel_id = voe_send_.channel_id;
256 audio_send_config_.rtp.ssrc = kAudioSendSsrc; 258 audio_send_config_.rtp.ssrc = kAudioSendSsrc;
257 audio_send_config_.send_codec_spec.codec_inst = 259 audio_send_config_.send_codec_spec =
258 CodecInst{kAudioSendPayloadType, "OPUS", 48000, 960, 2, 64000}; 260 rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
261 {kAudioSendPayloadType, {"OPUS", 48000, 2, {{"stereo", "1"}}}});
262 audio_send_config_.encoder_factory = encoder_factory_;
259 } 263 }
260 264
261 // TODO(brandtr): Update this when we support multistream protection. 265 // TODO(brandtr): Update this when we support multistream protection.
262 if (num_flexfec_streams > 0) { 266 if (num_flexfec_streams > 0) {
263 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType; 267 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType;
264 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc; 268 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc;
265 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]}; 269 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]};
266 } 270 }
267 } 271 }
268 272
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 578
575 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 579 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
576 } 580 }
577 581
578 bool EndToEndTest::ShouldCreateReceivers() const { 582 bool EndToEndTest::ShouldCreateReceivers() const {
579 return true; 583 return true;
580 } 584 }
581 585
582 } // namespace test 586 } // namespace test
583 } // namespace webrtc 587 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698