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

Side by Side Diff: webrtc/video/video_quality_test.cc

Issue 2303273002: Expose Ivf logging through the native API (Closed)
Patch Set: Nit Created 4 years, 2 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
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 #include <stdio.h> 12 #include <stdio.h>
13 #include <algorithm> 13 #include <algorithm>
14 #include <deque> 14 #include <deque>
15 #include <map> 15 #include <map>
16 #include <sstream> 16 #include <sstream>
17 #include <string> 17 #include <string>
18 #include <vector> 18 #include <vector>
19 19
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 const double avg_ssim_threshold_; 792 const double avg_ssim_threshold_;
792 793
793 rtc::CriticalSection comparison_lock_; 794 rtc::CriticalSection comparison_lock_;
794 std::vector<rtc::PlatformThread*> comparison_thread_pool_; 795 std::vector<rtc::PlatformThread*> comparison_thread_pool_;
795 rtc::PlatformThread stats_polling_thread_; 796 rtc::PlatformThread stats_polling_thread_;
796 rtc::Event comparison_available_event_; 797 rtc::Event comparison_available_event_;
797 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); 798 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_);
798 rtc::Event done_; 799 rtc::Event done_;
799 }; 800 };
800 801
801 VideoQualityTest::VideoQualityTest() : clock_(Clock::GetRealTimeClock()) {} 802 VideoQualityTest::VideoQualityTest()
803 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {}
802 804
803 void VideoQualityTest::TestBody() {} 805 void VideoQualityTest::TestBody() {}
804 806
805 std::string VideoQualityTest::GenerateGraphTitle() const { 807 std::string VideoQualityTest::GenerateGraphTitle() const {
806 std::stringstream ss; 808 std::stringstream ss;
807 ss << params_.common.codec; 809 ss << params_.common.codec;
808 ss << " (" << params_.common.target_bitrate_bps / 1000 << "kbps"; 810 ss << " (" << params_.common.target_bitrate_bps / 1000 << "kbps";
809 ss << ", " << params_.common.fps << " FPS"; 811 ss << ", " << params_.common.fps << " FPS";
810 if (params_.screenshare.scroll_duration) 812 if (params_.screenshare.scroll_duration)
811 ss << ", " << params_.screenshare.scroll_duration << "s scroll"; 813 ss << ", " << params_.screenshare.scroll_duration << "s scroll";
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 SetupScreenshare(); 1183 SetupScreenshare();
1182 1184
1183 CreateVideoStreams(); 1185 CreateVideoStreams();
1184 analyzer.SetSendStream(video_send_stream_); 1186 analyzer.SetSendStream(video_send_stream_);
1185 video_send_stream_->SetSource(analyzer.OutputInterface()); 1187 video_send_stream_->SetSource(analyzer.OutputInterface());
1186 1188
1187 CreateCapturer(); 1189 CreateCapturer();
1188 rtc::VideoSinkWants wants; 1190 rtc::VideoSinkWants wants;
1189 capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); 1191 capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants);
1190 1192
1193 StartEncodedFrameLogs(video_send_stream_);
1194 StartEncodedFrameLogs(video_receive_streams_[0]);
1191 video_send_stream_->Start(); 1195 video_send_stream_->Start();
1192 for (VideoReceiveStream* receive_stream : video_receive_streams_) 1196 for (VideoReceiveStream* receive_stream : video_receive_streams_)
1193 receive_stream->Start(); 1197 receive_stream->Start();
1194 capturer_->Start(); 1198 capturer_->Start();
1195 1199
1196 analyzer.Wait(); 1200 analyzer.Wait();
1197 1201
1198 send_transport.StopSending(); 1202 send_transport.StopSending();
1199 recv_transport.StopSending(); 1203 recv_transport.StopSending();
1200 1204
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 1308 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
1305 audio_config.rtcp_send_transport = &transport; 1309 audio_config.rtcp_send_transport = &transport;
1306 audio_config.voe_channel_id = voe.receive_channel_id; 1310 audio_config.voe_channel_id = voe.receive_channel_id;
1307 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 1311 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
1308 audio_config.rtp.transport_cc = params_.common.send_side_bwe; 1312 audio_config.rtp.transport_cc = params_.common.send_side_bwe;
1309 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; 1313 audio_config.rtp.extensions = audio_send_config_.rtp.extensions;
1310 audio_config.decoder_factory = decoder_factory_; 1314 audio_config.decoder_factory = decoder_factory_;
1311 if (params_.audio_video_sync) 1315 if (params_.audio_video_sync)
1312 audio_config.sync_group = kSyncGroup; 1316 audio_config.sync_group = kSyncGroup;
1313 1317
1314 audio_receive_stream =call->CreateAudioReceiveStream(audio_config); 1318 audio_receive_stream = call->CreateAudioReceiveStream(audio_config);
1315 1319
1316 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000}; 1320 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000};
1317 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst)); 1321 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst));
1318 } 1322 }
1319 1323
1324 StartEncodedFrameLogs(video_receive_stream);
1325 StartEncodedFrameLogs(video_send_stream_);
1326
1320 // Start sending and receiving video. 1327 // Start sending and receiving video.
1321 video_receive_stream->Start(); 1328 video_receive_stream->Start();
1322 video_send_stream_->Start(); 1329 video_send_stream_->Start();
1323 capturer_->Start(); 1330 capturer_->Start();
1324 1331
1325 if (params_.audio) { 1332 if (params_.audio) {
1326 // Start receiving audio. 1333 // Start receiving audio.
1327 audio_receive_stream->Start(); 1334 audio_receive_stream->Start();
1328 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); 1335 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id));
1329 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id)); 1336 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id));
(...skipping 27 matching lines...) Expand all
1357 if (params_.audio) { 1364 if (params_.audio) {
1358 call->DestroyAudioSendStream(audio_send_stream_); 1365 call->DestroyAudioSendStream(audio_send_stream_);
1359 call->DestroyAudioReceiveStream(audio_receive_stream); 1366 call->DestroyAudioReceiveStream(audio_receive_stream);
1360 } 1367 }
1361 1368
1362 transport.StopSending(); 1369 transport.StopSending();
1363 if (params_.audio) 1370 if (params_.audio)
1364 DestroyVoiceEngine(&voe); 1371 DestroyVoiceEngine(&voe);
1365 } 1372 }
1366 1373
1374 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) {
1375 if (!params_.common.encoded_frame_base_path.empty()) {
1376 std::ostringstream str;
1377 str << send_logs_++;
1378 std::string prefix =
1379 params_.common.encoded_frame_base_path + "." + str.str() + ".send.";
1380 stream->EnableEncodedFrameRecording(
1381 std::vector<rtc::PlatformFile>(
1382 {rtc::CreatePlatformFile(prefix + "1.ivf"),
1383 rtc::CreatePlatformFile(prefix + "2.ivf"),
1384 rtc::CreatePlatformFile(prefix + "3.ivf")}),
1385 10000000);
1386 }
1387 }
1388 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) {
1389 if (!params_.common.encoded_frame_base_path.empty()) {
1390 std::ostringstream str;
1391 str << receive_logs_++;
1392 std::string path =
1393 params_.common.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1394 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1395 10000000);
1396 }
1397 }
1398
1367 } // namespace webrtc 1399 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698