| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #include "webrtc/video/video_quality_test.h" | 10 #include "webrtc/video/video_quality_test.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 31 #include "webrtc/system_wrappers/include/cpu_info.h" | 31 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 32 #include "webrtc/test/gtest.h" | 32 #include "webrtc/test/gtest.h" |
| 33 #include "webrtc/test/layer_filtering_transport.h" | 33 #include "webrtc/test/layer_filtering_transport.h" |
| 34 #include "webrtc/test/run_loop.h" | 34 #include "webrtc/test/run_loop.h" |
| 35 #include "webrtc/test/statistics.h" | 35 #include "webrtc/test/statistics.h" |
| 36 #include "webrtc/test/testsupport/fileutils.h" | 36 #include "webrtc/test/testsupport/fileutils.h" |
| 37 #include "webrtc/test/vcm_capturer.h" | 37 #include "webrtc/test/vcm_capturer.h" |
| 38 #include "webrtc/test/video_renderer.h" | 38 #include "webrtc/test/video_renderer.h" |
| 39 #include "webrtc/voice_engine/include/voe_base.h" | 39 #include "webrtc/voice_engine/include/voe_base.h" |
| 40 #include "webrtc/voice_engine/include/voe_codec.h" | |
| 41 | 40 |
| 42 namespace { | 41 namespace { |
| 43 | 42 |
| 44 constexpr int kSendStatsPollingIntervalMs = 1000; | 43 constexpr int kSendStatsPollingIntervalMs = 1000; |
| 45 constexpr int kPayloadTypeH264 = 122; | 44 constexpr int kPayloadTypeH264 = 122; |
| 46 constexpr int kPayloadTypeVP8 = 123; | 45 constexpr int kPayloadTypeVP8 = 123; |
| 47 constexpr int kPayloadTypeVP9 = 124; | 46 constexpr int kPayloadTypeVP9 = 124; |
| 48 constexpr size_t kMaxComparisons = 10; | 47 constexpr size_t kMaxComparisons = 10; |
| 49 constexpr char kSyncGroup[] = "av_sync"; | 48 constexpr char kSyncGroup[] = "av_sync"; |
| 50 constexpr int kOpusMinBitrate = 6000; | 49 constexpr int kOpusMinBitrate = 6000; |
| 51 constexpr int kOpusBitrateFb = 32000; | 50 constexpr int kOpusBitrateFb = 32000; |
| 52 | 51 |
| 53 struct VoiceEngineState { | 52 struct VoiceEngineState { |
| 54 VoiceEngineState() | 53 VoiceEngineState() |
| 55 : voice_engine(nullptr), | 54 : voice_engine(nullptr), |
| 56 base(nullptr), | 55 base(nullptr), |
| 57 codec(nullptr), | |
| 58 send_channel_id(-1), | 56 send_channel_id(-1), |
| 59 receive_channel_id(-1) {} | 57 receive_channel_id(-1) {} |
| 60 | 58 |
| 61 webrtc::VoiceEngine* voice_engine; | 59 webrtc::VoiceEngine* voice_engine; |
| 62 webrtc::VoEBase* base; | 60 webrtc::VoEBase* base; |
| 63 webrtc::VoECodec* codec; | |
| 64 int send_channel_id; | 61 int send_channel_id; |
| 65 int receive_channel_id; | 62 int receive_channel_id; |
| 66 }; | 63 }; |
| 67 | 64 |
| 68 void CreateVoiceEngine(VoiceEngineState* voe, | 65 void CreateVoiceEngine(VoiceEngineState* voe, |
| 69 rtc::scoped_refptr<webrtc::AudioDecoderFactory> | 66 rtc::scoped_refptr<webrtc::AudioDecoderFactory> |
| 70 decoder_factory) { | 67 decoder_factory) { |
| 71 voe->voice_engine = webrtc::VoiceEngine::Create(); | 68 voe->voice_engine = webrtc::VoiceEngine::Create(); |
| 72 voe->base = webrtc::VoEBase::GetInterface(voe->voice_engine); | 69 voe->base = webrtc::VoEBase::GetInterface(voe->voice_engine); |
| 73 voe->codec = webrtc::VoECodec::GetInterface(voe->voice_engine); | |
| 74 EXPECT_EQ(0, voe->base->Init(nullptr, nullptr, decoder_factory)); | 70 EXPECT_EQ(0, voe->base->Init(nullptr, nullptr, decoder_factory)); |
| 75 webrtc::VoEBase::ChannelConfig config; | 71 webrtc::VoEBase::ChannelConfig config; |
| 76 config.enable_voice_pacing = true; | 72 config.enable_voice_pacing = true; |
| 77 voe->send_channel_id = voe->base->CreateChannel(config); | 73 voe->send_channel_id = voe->base->CreateChannel(config); |
| 78 EXPECT_GE(voe->send_channel_id, 0); | 74 EXPECT_GE(voe->send_channel_id, 0); |
| 79 voe->receive_channel_id = voe->base->CreateChannel(); | 75 voe->receive_channel_id = voe->base->CreateChannel(); |
| 80 EXPECT_GE(voe->receive_channel_id, 0); | 76 EXPECT_GE(voe->receive_channel_id, 0); |
| 81 } | 77 } |
| 82 | 78 |
| 83 void DestroyVoiceEngine(VoiceEngineState* voe) { | 79 void DestroyVoiceEngine(VoiceEngineState* voe) { |
| 84 voe->base->DeleteChannel(voe->send_channel_id); | 80 voe->base->DeleteChannel(voe->send_channel_id); |
| 85 voe->send_channel_id = -1; | 81 voe->send_channel_id = -1; |
| 86 voe->base->DeleteChannel(voe->receive_channel_id); | 82 voe->base->DeleteChannel(voe->receive_channel_id); |
| 87 voe->receive_channel_id = -1; | 83 voe->receive_channel_id = -1; |
| 88 voe->base->Release(); | 84 voe->base->Release(); |
| 89 voe->base = nullptr; | 85 voe->base = nullptr; |
| 90 voe->codec->Release(); | |
| 91 voe->codec = nullptr; | |
| 92 | 86 |
| 93 webrtc::VoiceEngine::Delete(voe->voice_engine); | 87 webrtc::VoiceEngine::Delete(voe->voice_engine); |
| 94 voe->voice_engine = nullptr; | 88 voe->voice_engine = nullptr; |
| 95 } | 89 } |
| 96 | 90 |
| 97 class VideoStreamFactory | 91 class VideoStreamFactory |
| 98 : public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface { | 92 : public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface { |
| 99 public: | 93 public: |
| 100 explicit VideoStreamFactory(const std::vector<webrtc::VideoStream>& streams) | 94 explicit VideoStreamFactory(const std::vector<webrtc::VideoStream>& streams) |
| 101 : streams_(streams) {} | 95 : streams_(streams) {} |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 // Add extension to enable audio send side BWE, and allow audio bit rate | 1317 // Add extension to enable audio send side BWE, and allow audio bit rate |
| 1324 // adaptation. | 1318 // adaptation. |
| 1325 audio_send_config_.rtp.extensions.clear(); | 1319 audio_send_config_.rtp.extensions.clear(); |
| 1326 if (params_.common.send_side_bwe) { | 1320 if (params_.common.send_side_bwe) { |
| 1327 audio_send_config_.rtp.extensions.push_back(webrtc::RtpExtension( | 1321 audio_send_config_.rtp.extensions.push_back(webrtc::RtpExtension( |
| 1328 webrtc::RtpExtension::kTransportSequenceNumberUri, | 1322 webrtc::RtpExtension::kTransportSequenceNumberUri, |
| 1329 test::kTransportSequenceNumberExtensionId)); | 1323 test::kTransportSequenceNumberExtensionId)); |
| 1330 audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000; | 1324 audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000; |
| 1331 audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000; | 1325 audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000; |
| 1332 } | 1326 } |
| 1327 audio_send_config_.send_codec_spec.codec_inst = |
| 1328 CodecInst{120, "OPUS", 48000, 960, 2, 64000}; |
| 1333 | 1329 |
| 1334 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); | 1330 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); |
| 1335 | 1331 |
| 1336 AudioReceiveStream::Config audio_config; | 1332 AudioReceiveStream::Config audio_config; |
| 1337 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | 1333 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; |
| 1338 audio_config.rtcp_send_transport = &transport; | 1334 audio_config.rtcp_send_transport = &transport; |
| 1339 audio_config.voe_channel_id = voe.receive_channel_id; | 1335 audio_config.voe_channel_id = voe.receive_channel_id; |
| 1340 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | 1336 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; |
| 1341 audio_config.rtp.transport_cc = params_.common.send_side_bwe; | 1337 audio_config.rtp.transport_cc = params_.common.send_side_bwe; |
| 1342 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; | 1338 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; |
| 1343 audio_config.decoder_factory = decoder_factory_; | 1339 audio_config.decoder_factory = decoder_factory_; |
| 1344 if (params_.audio_video_sync) | 1340 if (params_.audio_video_sync) |
| 1345 audio_config.sync_group = kSyncGroup; | 1341 audio_config.sync_group = kSyncGroup; |
| 1346 | 1342 |
| 1347 audio_receive_stream = call->CreateAudioReceiveStream(audio_config); | 1343 audio_receive_stream = call->CreateAudioReceiveStream(audio_config); |
| 1348 | |
| 1349 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000}; | |
| 1350 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst)); | |
| 1351 } | 1344 } |
| 1352 | 1345 |
| 1353 StartEncodedFrameLogs(video_receive_stream); | 1346 StartEncodedFrameLogs(video_receive_stream); |
| 1354 StartEncodedFrameLogs(video_send_stream_); | 1347 StartEncodedFrameLogs(video_send_stream_); |
| 1355 | 1348 |
| 1356 // Start sending and receiving video. | 1349 // Start sending and receiving video. |
| 1357 video_receive_stream->Start(); | 1350 video_receive_stream->Start(); |
| 1358 video_send_stream_->Start(); | 1351 video_send_stream_->Start(); |
| 1359 capturer_->Start(); | 1352 capturer_->Start(); |
| 1360 | 1353 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 std::ostringstream str; | 1412 std::ostringstream str; |
| 1420 str << receive_logs_++; | 1413 str << receive_logs_++; |
| 1421 std::string path = | 1414 std::string path = |
| 1422 params_.common.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1415 params_.common.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1423 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1416 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1424 10000000); | 1417 10000000); |
| 1425 } | 1418 } |
| 1426 } | 1419 } |
| 1427 | 1420 |
| 1428 } // namespace webrtc | 1421 } // namespace webrtc |
| OLD | NEW |