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 <stdio.h> | 10 #include <stdio.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <deque> | 13 #include <deque> |
14 #include <map> | 14 #include <map> |
15 #include <sstream> | 15 #include <sstream> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 #include "webrtc/base/checks.h" | 21 #include "webrtc/base/checks.h" |
22 #include "webrtc/base/event.h" | 22 #include "webrtc/base/event.h" |
23 #include "webrtc/base/format_macros.h" | 23 #include "webrtc/base/format_macros.h" |
24 #include "webrtc/base/optional.h" | 24 #include "webrtc/base/optional.h" |
| 25 #include "webrtc/base/platform_file.h" |
25 #include "webrtc/base/timeutils.h" | 26 #include "webrtc/base/timeutils.h" |
26 #include "webrtc/call.h" | 27 #include "webrtc/call.h" |
27 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 28 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
28 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 29 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
30 #include "webrtc/system_wrappers/include/cpu_info.h" | 31 #include "webrtc/system_wrappers/include/cpu_info.h" |
31 #include "webrtc/test/layer_filtering_transport.h" | 32 #include "webrtc/test/layer_filtering_transport.h" |
32 #include "webrtc/test/run_loop.h" | 33 #include "webrtc/test/run_loop.h" |
33 #include "webrtc/test/statistics.h" | 34 #include "webrtc/test/statistics.h" |
34 #include "webrtc/test/testsupport/fileutils.h" | 35 #include "webrtc/test/testsupport/fileutils.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 const double avg_ssim_threshold_; | 739 const double avg_ssim_threshold_; |
739 | 740 |
740 rtc::CriticalSection comparison_lock_; | 741 rtc::CriticalSection comparison_lock_; |
741 std::vector<rtc::PlatformThread*> comparison_thread_pool_; | 742 std::vector<rtc::PlatformThread*> comparison_thread_pool_; |
742 rtc::PlatformThread stats_polling_thread_; | 743 rtc::PlatformThread stats_polling_thread_; |
743 rtc::Event comparison_available_event_; | 744 rtc::Event comparison_available_event_; |
744 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); | 745 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); |
745 rtc::Event done_; | 746 rtc::Event done_; |
746 }; | 747 }; |
747 | 748 |
748 VideoQualityTest::VideoQualityTest() : clock_(Clock::GetRealTimeClock()) {} | 749 VideoQualityTest::VideoQualityTest() |
| 750 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} |
749 | 751 |
750 void VideoQualityTest::TestBody() {} | 752 void VideoQualityTest::TestBody() {} |
751 | 753 |
752 std::string VideoQualityTest::GenerateGraphTitle() const { | 754 std::string VideoQualityTest::GenerateGraphTitle() const { |
753 std::stringstream ss; | 755 std::stringstream ss; |
754 ss << params_.common.codec; | 756 ss << params_.common.codec; |
755 ss << " (" << params_.common.target_bitrate_bps / 1000 << "kbps"; | 757 ss << " (" << params_.common.target_bitrate_bps / 1000 << "kbps"; |
756 ss << ", " << params_.common.fps << " FPS"; | 758 ss << ", " << params_.common.fps << " FPS"; |
757 if (params_.screenshare.scroll_duration) | 759 if (params_.screenshare.scroll_duration) |
758 ss << ", " << params_.screenshare.scroll_duration << "s scroll"; | 760 ss << ", " << params_.screenshare.scroll_duration << "s scroll"; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 | 1127 |
1126 if (params_.screenshare.enabled) | 1128 if (params_.screenshare.enabled) |
1127 SetupScreenshare(); | 1129 SetupScreenshare(); |
1128 | 1130 |
1129 CreateVideoStreams(); | 1131 CreateVideoStreams(); |
1130 analyzer.input_ = video_send_stream_->Input(); | 1132 analyzer.input_ = video_send_stream_->Input(); |
1131 analyzer.send_stream_ = video_send_stream_; | 1133 analyzer.send_stream_ = video_send_stream_; |
1132 | 1134 |
1133 CreateCapturer(&analyzer); | 1135 CreateCapturer(&analyzer); |
1134 | 1136 |
| 1137 StartEncodedFrameLogs(video_send_stream_); |
| 1138 StartEncodedFrameLogs(video_receive_streams_[0]); |
1135 video_send_stream_->Start(); | 1139 video_send_stream_->Start(); |
1136 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1140 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1137 receive_stream->Start(); | 1141 receive_stream->Start(); |
1138 capturer_->Start(); | 1142 capturer_->Start(); |
1139 | 1143 |
1140 analyzer.Wait(); | 1144 analyzer.Wait(); |
1141 | 1145 |
1142 send_transport.StopSending(); | 1146 send_transport.StopSending(); |
1143 recv_transport.StopSending(); | 1147 recv_transport.StopSending(); |
1144 | 1148 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | 1251 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; |
1248 audio_config.rtcp_send_transport = &transport; | 1252 audio_config.rtcp_send_transport = &transport; |
1249 audio_config.voe_channel_id = voe.receive_channel_id; | 1253 audio_config.voe_channel_id = voe.receive_channel_id; |
1250 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | 1254 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; |
1251 audio_config.rtp.transport_cc = params_.common.send_side_bwe; | 1255 audio_config.rtp.transport_cc = params_.common.send_side_bwe; |
1252 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; | 1256 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; |
1253 audio_config.decoder_factory = decoder_factory_; | 1257 audio_config.decoder_factory = decoder_factory_; |
1254 if (params_.audio_video_sync) | 1258 if (params_.audio_video_sync) |
1255 audio_config.sync_group = kSyncGroup; | 1259 audio_config.sync_group = kSyncGroup; |
1256 | 1260 |
1257 audio_receive_stream =call->CreateAudioReceiveStream(audio_config); | 1261 audio_receive_stream = call->CreateAudioReceiveStream(audio_config); |
1258 | 1262 |
1259 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000}; | 1263 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000}; |
1260 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst)); | 1264 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst)); |
1261 } | 1265 } |
1262 | 1266 |
| 1267 StartEncodedFrameLogs(video_receive_stream); |
| 1268 StartEncodedFrameLogs(video_send_stream_); |
| 1269 |
1263 // Start sending and receiving video. | 1270 // Start sending and receiving video. |
1264 video_receive_stream->Start(); | 1271 video_receive_stream->Start(); |
1265 video_send_stream_->Start(); | 1272 video_send_stream_->Start(); |
1266 capturer_->Start(); | 1273 capturer_->Start(); |
1267 | 1274 |
1268 if (params_.audio) { | 1275 if (params_.audio) { |
1269 // Start receiving audio. | 1276 // Start receiving audio. |
1270 audio_receive_stream->Start(); | 1277 audio_receive_stream->Start(); |
1271 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); | 1278 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); |
1272 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id)); | 1279 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id)); |
(...skipping 27 matching lines...) Expand all Loading... |
1300 if (params_.audio) { | 1307 if (params_.audio) { |
1301 call->DestroyAudioSendStream(audio_send_stream_); | 1308 call->DestroyAudioSendStream(audio_send_stream_); |
1302 call->DestroyAudioReceiveStream(audio_receive_stream); | 1309 call->DestroyAudioReceiveStream(audio_receive_stream); |
1303 } | 1310 } |
1304 | 1311 |
1305 transport.StopSending(); | 1312 transport.StopSending(); |
1306 if (params_.audio) | 1313 if (params_.audio) |
1307 DestroyVoiceEngine(&voe); | 1314 DestroyVoiceEngine(&voe); |
1308 } | 1315 } |
1309 | 1316 |
| 1317 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { |
| 1318 if (!params_.common.encoded_frame_base_path.empty()) { |
| 1319 std::ostringstream str; |
| 1320 str << send_logs_++; |
| 1321 std::string prefix = |
| 1322 params_.common.encoded_frame_base_path + "." + str.str() + ".send."; |
| 1323 stream->EnableEncodedFrameRecording( |
| 1324 std::vector<rtc::PlatformFile>( |
| 1325 {rtc::CreatePlatformFile(prefix + "1.ivf"), |
| 1326 rtc::CreatePlatformFile(prefix + "2.ivf"), |
| 1327 rtc::CreatePlatformFile(prefix + "3.ivf")}), |
| 1328 10000000); |
| 1329 } |
| 1330 } |
| 1331 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) { |
| 1332 if (!params_.common.encoded_frame_base_path.empty()) { |
| 1333 std::ostringstream str; |
| 1334 str << receive_logs_++; |
| 1335 std::string path = |
| 1336 params_.common.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1337 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1338 10000000); |
| 1339 } |
| 1340 } |
| 1341 |
1310 } // namespace webrtc | 1342 } // namespace webrtc |
OLD | NEW |