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

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

Issue 2314403007: Reland of "Separating video settings in VideoQualityTest". (Closed)
Patch Set: fixing 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') | no next file » | 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"
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 std::vector<rtc::PlatformThread*> comparison_thread_pool_; 813 std::vector<rtc::PlatformThread*> comparison_thread_pool_;
814 rtc::PlatformThread stats_polling_thread_; 814 rtc::PlatformThread stats_polling_thread_;
815 rtc::Event comparison_available_event_; 815 rtc::Event comparison_available_event_;
816 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); 816 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_);
817 rtc::Event done_; 817 rtc::Event done_;
818 }; 818 };
819 819
820 VideoQualityTest::VideoQualityTest() 820 VideoQualityTest::VideoQualityTest()
821 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} 821 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {}
822 822
823 VideoQualityTest::Params::Params()
824 : call({false, Call::Config::BitrateConfig()}),
825 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false,
826 "", ""}),
827 audio({false, false}),
828 screenshare({false, 10, 0}),
829 analyzer({"", 0.0, 0.0, 0, "", ""}),
830 pipe(),
831 logs(false),
832 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}) {}
833
834 VideoQualityTest::Params::~Params() = default;
835
823 void VideoQualityTest::TestBody() {} 836 void VideoQualityTest::TestBody() {}
824 837
825 std::string VideoQualityTest::GenerateGraphTitle() const { 838 std::string VideoQualityTest::GenerateGraphTitle() const {
826 std::stringstream ss; 839 std::stringstream ss;
827 ss << params_.common.codec; 840 ss << params_.video.codec;
828 ss << " (" << params_.common.target_bitrate_bps / 1000 << "kbps"; 841 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps";
829 ss << ", " << params_.common.fps << " FPS"; 842 ss << ", " << params_.video.fps << " FPS";
830 if (params_.screenshare.scroll_duration) 843 if (params_.screenshare.scroll_duration)
831 ss << ", " << params_.screenshare.scroll_duration << "s scroll"; 844 ss << ", " << params_.screenshare.scroll_duration << "s scroll";
832 if (params_.ss.streams.size() > 1) 845 if (params_.ss.streams.size() > 1)
833 ss << ", Stream #" << params_.ss.selected_stream; 846 ss << ", Stream #" << params_.ss.selected_stream;
834 if (params_.ss.num_spatial_layers > 1) 847 if (params_.ss.num_spatial_layers > 1)
835 ss << ", Layer #" << params_.ss.selected_sl; 848 ss << ", Layer #" << params_.ss.selected_sl;
836 ss << ")"; 849 ss << ")";
837 return ss.str(); 850 return ss.str();
838 } 851 }
839 852
840 void VideoQualityTest::CheckParams() { 853 void VideoQualityTest::CheckParams() {
841 // Add a default stream in none specified. 854 // Add a default stream in none specified.
842 if (params_.ss.streams.empty()) 855 if (params_.ss.streams.empty())
843 params_.ss.streams.push_back(VideoQualityTest::DefaultVideoStream(params_)); 856 params_.ss.streams.push_back(VideoQualityTest::DefaultVideoStream(params_));
844 if (params_.ss.num_spatial_layers == 0) 857 if (params_.ss.num_spatial_layers == 0)
845 params_.ss.num_spatial_layers = 1; 858 params_.ss.num_spatial_layers = 1;
846 859
847 if (params_.pipe.loss_percent != 0 || 860 if (params_.pipe.loss_percent != 0 ||
848 params_.pipe.queue_length_packets != 0) { 861 params_.pipe.queue_length_packets != 0) {
849 // Since LayerFilteringTransport changes the sequence numbers, we can't 862 // Since LayerFilteringTransport changes the sequence numbers, we can't
850 // use that feature with pack loss, since the NACK request would end up 863 // use that feature with pack loss, since the NACK request would end up
851 // retransmitting the wrong packets. 864 // retransmitting the wrong packets.
852 RTC_CHECK(params_.ss.selected_sl == -1 || 865 RTC_CHECK(params_.ss.selected_sl == -1 ||
853 params_.ss.selected_sl == params_.ss.num_spatial_layers - 1); 866 params_.ss.selected_sl == params_.ss.num_spatial_layers - 1);
854 RTC_CHECK(params_.common.selected_tl == -1 || 867 RTC_CHECK(params_.video.selected_tl == -1 ||
855 params_.common.selected_tl == 868 params_.video.selected_tl ==
856 params_.common.num_temporal_layers - 1); 869 params_.video.num_temporal_layers - 1);
857 } 870 }
858 871
859 // TODO(ivica): Should max_bitrate_bps == -1 represent inf max bitrate, as it 872 // TODO(ivica): Should max_bitrate_bps == -1 represent inf max bitrate, as it
860 // does in some parts of the code? 873 // does in some parts of the code?
861 RTC_CHECK_GE(params_.common.max_bitrate_bps, 874 RTC_CHECK_GE(params_.video.max_bitrate_bps, params_.video.target_bitrate_bps);
862 params_.common.target_bitrate_bps); 875 RTC_CHECK_GE(params_.video.target_bitrate_bps, params_.video.min_bitrate_bps);
863 RTC_CHECK_GE(params_.common.target_bitrate_bps, 876 RTC_CHECK_LT(params_.video.selected_tl, params_.video.num_temporal_layers);
864 params_.common.min_bitrate_bps);
865 RTC_CHECK_LT(params_.common.selected_tl, params_.common.num_temporal_layers);
866 RTC_CHECK_LT(params_.ss.selected_stream, params_.ss.streams.size()); 877 RTC_CHECK_LT(params_.ss.selected_stream, params_.ss.streams.size());
867 for (const VideoStream& stream : params_.ss.streams) { 878 for (const VideoStream& stream : params_.ss.streams) {
868 RTC_CHECK_GE(stream.min_bitrate_bps, 0); 879 RTC_CHECK_GE(stream.min_bitrate_bps, 0);
869 RTC_CHECK_GE(stream.target_bitrate_bps, stream.min_bitrate_bps); 880 RTC_CHECK_GE(stream.target_bitrate_bps, stream.min_bitrate_bps);
870 RTC_CHECK_GE(stream.max_bitrate_bps, stream.target_bitrate_bps); 881 RTC_CHECK_GE(stream.max_bitrate_bps, stream.target_bitrate_bps);
871 RTC_CHECK_EQ(static_cast<int>(stream.temporal_layer_thresholds_bps.size()), 882 RTC_CHECK_EQ(static_cast<int>(stream.temporal_layer_thresholds_bps.size()),
872 params_.common.num_temporal_layers - 1); 883 params_.video.num_temporal_layers - 1);
873 } 884 }
874 // TODO(ivica): Should we check if the sum of all streams/layers is equal to 885 // TODO(ivica): Should we check if the sum of all streams/layers is equal to
875 // the total bitrate? We anyway have to update them in the case bitrate 886 // the total bitrate? We anyway have to update them in the case bitrate
876 // estimator changes the total bitrates. 887 // estimator changes the total bitrates.
877 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); 888 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1);
878 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); 889 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers);
879 RTC_CHECK(params_.ss.spatial_layers.empty() || 890 RTC_CHECK(params_.ss.spatial_layers.empty() ||
880 params_.ss.spatial_layers.size() == 891 params_.ss.spatial_layers.size() ==
881 static_cast<size_t>(params_.ss.num_spatial_layers)); 892 static_cast<size_t>(params_.ss.num_spatial_layers));
882 if (params_.common.codec == "VP8") { 893 if (params_.video.codec == "VP8") {
883 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); 894 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1);
884 } else if (params_.common.codec == "VP9") { 895 } else if (params_.video.codec == "VP9") {
885 RTC_CHECK_EQ(params_.ss.streams.size(), 1u); 896 RTC_CHECK_EQ(params_.ss.streams.size(), 1u);
886 } 897 }
887 } 898 }
888 899
889 // Static. 900 // Static.
890 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) { 901 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) {
891 // Parse comma separated nonnegative integers, where some elements may be 902 // Parse comma separated nonnegative integers, where some elements may be
892 // empty. The empty values are replaced with -1. 903 // empty. The empty values are replaced with -1.
893 // E.g. "10,-20,,30,40" --> {10, 20, -1, 30,40} 904 // E.g. "10,-20,,30,40" --> {10, 20, -1, 30,40}
894 // E.g. ",,10,,20," --> {-1, -1, 10, -1, 20, -1} 905 // E.g. ",,10,,20," --> {-1, -1, 10, -1, 20, -1}
(...skipping 15 matching lines...) Expand all
910 << "Unexpected non-number value."; 921 << "Unexpected non-number value.";
911 p += pos; 922 p += pos;
912 } 923 }
913 result.push_back(value); 924 result.push_back(value);
914 return result; 925 return result;
915 } 926 }
916 927
917 // Static. 928 // Static.
918 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { 929 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) {
919 VideoStream stream; 930 VideoStream stream;
920 stream.width = params.common.width; 931 stream.width = params.video.width;
921 stream.height = params.common.height; 932 stream.height = params.video.height;
922 stream.max_framerate = params.common.fps; 933 stream.max_framerate = params.video.fps;
923 stream.min_bitrate_bps = params.common.min_bitrate_bps; 934 stream.min_bitrate_bps = params.video.min_bitrate_bps;
924 stream.target_bitrate_bps = params.common.target_bitrate_bps; 935 stream.target_bitrate_bps = params.video.target_bitrate_bps;
925 stream.max_bitrate_bps = params.common.max_bitrate_bps; 936 stream.max_bitrate_bps = params.video.max_bitrate_bps;
926 stream.max_qp = 52; 937 stream.max_qp = 52;
927 if (params.common.num_temporal_layers == 2) 938 if (params.video.num_temporal_layers == 2)
928 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); 939 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps);
929 return stream; 940 return stream;
930 } 941 }
931 942
932 // Static. 943 // Static.
933 void VideoQualityTest::FillScalabilitySettings( 944 void VideoQualityTest::FillScalabilitySettings(
934 Params* params, 945 Params* params,
935 const std::vector<std::string>& stream_descriptors, 946 const std::vector<std::string>& stream_descriptors,
936 size_t selected_stream, 947 size_t selected_stream,
937 int num_spatial_layers, 948 int num_spatial_layers,
(...skipping 22 matching lines...) Expand all
960 if (v[5] != -1) 971 if (v[5] != -1)
961 stream.max_bitrate_bps = v[5]; 972 stream.max_bitrate_bps = v[5];
962 if (v.size() > 6 && v[6] != -1) 973 if (v.size() > 6 && v[6] != -1)
963 stream.max_qp = v[6]; 974 stream.max_qp = v[6];
964 if (v.size() > 7) { 975 if (v.size() > 7) {
965 stream.temporal_layer_thresholds_bps.clear(); 976 stream.temporal_layer_thresholds_bps.clear();
966 stream.temporal_layer_thresholds_bps.insert( 977 stream.temporal_layer_thresholds_bps.insert(
967 stream.temporal_layer_thresholds_bps.end(), v.begin() + 7, v.end()); 978 stream.temporal_layer_thresholds_bps.end(), v.begin() + 7, v.end());
968 } else { 979 } else {
969 // Automatic TL thresholds for more than two layers not supported. 980 // Automatic TL thresholds for more than two layers not supported.
970 RTC_CHECK_LE(params->common.num_temporal_layers, 2); 981 RTC_CHECK_LE(params->video.num_temporal_layers, 2);
971 } 982 }
972 params->ss.streams.push_back(stream); 983 params->ss.streams.push_back(stream);
973 } 984 }
974 params->ss.selected_stream = selected_stream; 985 params->ss.selected_stream = selected_stream;
975 986
976 params->ss.num_spatial_layers = num_spatial_layers ? num_spatial_layers : 1; 987 params->ss.num_spatial_layers = num_spatial_layers ? num_spatial_layers : 1;
977 params->ss.selected_sl = selected_sl; 988 params->ss.selected_sl = selected_sl;
978 RTC_CHECK(params->ss.spatial_layers.empty()); 989 RTC_CHECK(params->ss.spatial_layers.empty());
979 for (auto descriptor : sl_descriptors) { 990 for (auto descriptor : sl_descriptors) {
980 if (descriptor.empty()) 991 if (descriptor.empty())
(...skipping 11 matching lines...) Expand all
992 1003
993 void VideoQualityTest::SetupCommon(Transport* send_transport, 1004 void VideoQualityTest::SetupCommon(Transport* send_transport,
994 Transport* recv_transport) { 1005 Transport* recv_transport) {
995 if (params_.logs) 1006 if (params_.logs)
996 trace_to_stderr_.reset(new test::TraceToStderr); 1007 trace_to_stderr_.reset(new test::TraceToStderr);
997 1008
998 size_t num_streams = params_.ss.streams.size(); 1009 size_t num_streams = params_.ss.streams.size();
999 CreateSendConfig(num_streams, 0, send_transport); 1010 CreateSendConfig(num_streams, 0, send_transport);
1000 1011
1001 int payload_type; 1012 int payload_type;
1002 if (params_.common.codec == "H264") { 1013 if (params_.video.codec == "H264") {
1003 encoder_.reset(VideoEncoder::Create(VideoEncoder::kH264)); 1014 encoder_.reset(VideoEncoder::Create(VideoEncoder::kH264));
1004 payload_type = kPayloadTypeH264; 1015 payload_type = kPayloadTypeH264;
1005 } else if (params_.common.codec == "VP8") { 1016 } else if (params_.video.codec == "VP8") {
1006 encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp8)); 1017 encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp8));
1007 payload_type = kPayloadTypeVP8; 1018 payload_type = kPayloadTypeVP8;
1008 } else if (params_.common.codec == "VP9") { 1019 } else if (params_.video.codec == "VP9") {
1009 encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp9)); 1020 encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp9));
1010 payload_type = kPayloadTypeVP9; 1021 payload_type = kPayloadTypeVP9;
1011 } else { 1022 } else {
1012 RTC_NOTREACHED() << "Codec not supported!"; 1023 RTC_NOTREACHED() << "Codec not supported!";
1013 return; 1024 return;
1014 } 1025 }
1015 video_send_config_.encoder_settings.encoder = encoder_.get(); 1026 video_send_config_.encoder_settings.encoder = encoder_.get();
1016 video_send_config_.encoder_settings.payload_name = params_.common.codec; 1027 video_send_config_.encoder_settings.payload_name = params_.video.codec;
1017 video_send_config_.encoder_settings.payload_type = payload_type; 1028 video_send_config_.encoder_settings.payload_type = payload_type;
1018 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 1029 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
1019 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; 1030 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType;
1020 for (size_t i = 0; i < num_streams; ++i) 1031 for (size_t i = 0; i < num_streams; ++i)
1021 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); 1032 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
1022 1033
1023 video_send_config_.rtp.extensions.clear(); 1034 video_send_config_.rtp.extensions.clear();
1024 if (params_.common.send_side_bwe) { 1035 if (params_.call.send_side_bwe) {
1025 video_send_config_.rtp.extensions.push_back( 1036 video_send_config_.rtp.extensions.push_back(
1026 RtpExtension(RtpExtension::kTransportSequenceNumberUri, 1037 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
1027 test::kTransportSequenceNumberExtensionId)); 1038 test::kTransportSequenceNumberExtensionId));
1028 } else { 1039 } else {
1029 video_send_config_.rtp.extensions.push_back(RtpExtension( 1040 video_send_config_.rtp.extensions.push_back(RtpExtension(
1030 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); 1041 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId));
1031 } 1042 }
1032 1043
1033 video_encoder_config_.min_transmit_bitrate_bps = 1044 video_encoder_config_.min_transmit_bitrate_bps =
1034 params_.common.min_transmit_bps; 1045 params_.video.min_transmit_bps;
1035 1046
1036 video_encoder_config_.number_of_streams = params_.ss.streams.size(); 1047 video_encoder_config_.number_of_streams = params_.ss.streams.size();
1037 video_encoder_config_.max_bitrate_bps = 0; 1048 video_encoder_config_.max_bitrate_bps = 0;
1038 for (size_t i = 0; i < params_.ss.streams.size(); ++i) { 1049 for (size_t i = 0; i < params_.ss.streams.size(); ++i) {
1039 video_encoder_config_.max_bitrate_bps += 1050 video_encoder_config_.max_bitrate_bps +=
1040 params_.ss.streams[i].max_bitrate_bps; 1051 params_.ss.streams[i].max_bitrate_bps;
1041 } 1052 }
1042 video_encoder_config_.video_stream_factory = 1053 video_encoder_config_.video_stream_factory =
1043 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); 1054 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams);
1044 1055
1045 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; 1056 video_encoder_config_.spatial_layers = params_.ss.spatial_layers;
1046 1057
1047 CreateMatchingReceiveConfigs(recv_transport); 1058 CreateMatchingReceiveConfigs(recv_transport);
1048 1059
1049 for (size_t i = 0; i < num_streams; ++i) { 1060 for (size_t i = 0; i < num_streams; ++i) {
1050 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 1061 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
1051 video_receive_configs_[i].rtp.rtx[payload_type].ssrc = kSendRtxSsrcs[i]; 1062 video_receive_configs_[i].rtp.rtx[payload_type].ssrc = kSendRtxSsrcs[i];
1052 video_receive_configs_[i].rtp.rtx[payload_type].payload_type = 1063 video_receive_configs_[i].rtp.rtx[payload_type].payload_type =
1053 kSendRtxPayloadType; 1064 kSendRtxPayloadType;
1054 video_receive_configs_[i].rtp.transport_cc = params_.common.send_side_bwe; 1065 video_receive_configs_[i].rtp.transport_cc = params_.call.send_side_bwe;
1055 } 1066 }
1056 } 1067 }
1057 1068
1058 void VideoQualityTest::SetupScreenshare() { 1069 void VideoQualityTest::SetupScreenshare() {
1059 RTC_CHECK(params_.screenshare.enabled); 1070 RTC_CHECK(params_.screenshare.enabled);
1060 1071
1061 // Fill out codec settings. 1072 // Fill out codec settings.
1062 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; 1073 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen;
1063 if (params_.common.codec == "VP8") { 1074 if (params_.video.codec == "VP8") {
1064 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); 1075 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings();
1065 vp8_settings.denoisingOn = false; 1076 vp8_settings.denoisingOn = false;
1066 vp8_settings.frameDroppingOn = false; 1077 vp8_settings.frameDroppingOn = false;
1067 vp8_settings.numberOfTemporalLayers = 1078 vp8_settings.numberOfTemporalLayers =
1068 static_cast<unsigned char>(params_.common.num_temporal_layers); 1079 static_cast<unsigned char>(params_.video.num_temporal_layers);
1069 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< 1080 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject<
1070 VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings); 1081 VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings);
1071 } else if (params_.common.codec == "VP9") { 1082 } else if (params_.video.codec == "VP9") {
1072 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); 1083 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings();
1073 vp9_settings.denoisingOn = false; 1084 vp9_settings.denoisingOn = false;
1074 vp9_settings.frameDroppingOn = false; 1085 vp9_settings.frameDroppingOn = false;
1075 vp9_settings.numberOfTemporalLayers = 1086 vp9_settings.numberOfTemporalLayers =
1076 static_cast<unsigned char>(params_.common.num_temporal_layers); 1087 static_cast<unsigned char>(params_.video.num_temporal_layers);
1077 vp9_settings.numberOfSpatialLayers = 1088 vp9_settings.numberOfSpatialLayers =
1078 static_cast<unsigned char>(params_.ss.num_spatial_layers); 1089 static_cast<unsigned char>(params_.ss.num_spatial_layers);
1079 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< 1090 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject<
1080 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); 1091 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings);
1081 } 1092 }
1082 1093
1083 // Setup frame generator. 1094 // Setup frame generator.
1084 const size_t kWidth = 1850; 1095 const size_t kWidth = 1850;
1085 const size_t kHeight = 1110; 1096 const size_t kHeight = 1110;
1086 std::vector<std::string> slides; 1097 std::vector<std::string> slides;
1087 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); 1098 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv"));
1088 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); 1099 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv"));
1089 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); 1100 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv"));
1090 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); 1101 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv"));
1091 1102
1092 if (params_.screenshare.scroll_duration == 0) { 1103 if (params_.screenshare.scroll_duration == 0) {
1093 // Cycle image every slide_change_interval seconds. 1104 // Cycle image every slide_change_interval seconds.
1094 frame_generator_.reset(test::FrameGenerator::CreateFromYuvFile( 1105 frame_generator_.reset(test::FrameGenerator::CreateFromYuvFile(
1095 slides, kWidth, kHeight, 1106 slides, kWidth, kHeight,
1096 params_.screenshare.slide_change_interval * params_.common.fps)); 1107 params_.screenshare.slide_change_interval * params_.video.fps));
1097 } else { 1108 } else {
1098 RTC_CHECK_LE(params_.common.width, kWidth); 1109 RTC_CHECK_LE(params_.video.width, kWidth);
1099 RTC_CHECK_LE(params_.common.height, kHeight); 1110 RTC_CHECK_LE(params_.video.height, kHeight);
1100 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); 1111 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0);
1101 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - 1112 const int kPauseDurationMs = (params_.screenshare.slide_change_interval -
1102 params_.screenshare.scroll_duration) * 1113 params_.screenshare.scroll_duration) *
1103 1000; 1114 1000;
1104 RTC_CHECK_LE(params_.screenshare.scroll_duration, 1115 RTC_CHECK_LE(params_.screenshare.scroll_duration,
1105 params_.screenshare.slide_change_interval); 1116 params_.screenshare.slide_change_interval);
1106 1117
1107 frame_generator_.reset( 1118 frame_generator_.reset(
1108 test::FrameGenerator::CreateScrollingInputFromYuvFiles( 1119 test::FrameGenerator::CreateScrollingInputFromYuvFiles(
1109 clock_, slides, kWidth, kHeight, params_.common.width, 1120 clock_, slides, kWidth, kHeight, params_.video.width,
1110 params_.common.height, params_.screenshare.scroll_duration * 1000, 1121 params_.video.height, params_.screenshare.scroll_duration * 1000,
1111 kPauseDurationMs)); 1122 kPauseDurationMs));
1112 } 1123 }
1113 } 1124 }
1114 1125
1115 void VideoQualityTest::CreateCapturer() { 1126 void VideoQualityTest::CreateCapturer() {
1116 if (params_.screenshare.enabled) { 1127 if (params_.screenshare.enabled) {
1117 test::FrameGeneratorCapturer* frame_generator_capturer = 1128 test::FrameGeneratorCapturer* frame_generator_capturer =
1118 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), 1129 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(),
1119 params_.common.fps); 1130 params_.video.fps);
1120 EXPECT_TRUE(frame_generator_capturer->Init()); 1131 EXPECT_TRUE(frame_generator_capturer->Init());
1121 capturer_.reset(frame_generator_capturer); 1132 capturer_.reset(frame_generator_capturer);
1122 } else { 1133 } else {
1123 if (params_.video.clip_name.empty()) { 1134 if (params_.video.clip_name.empty()) {
1124 capturer_.reset(test::VcmCapturer::Create( 1135 capturer_.reset(test::VcmCapturer::Create(
1125 params_.common.width, params_.common.height, params_.common.fps)); 1136 params_.video.width, params_.video.height, params_.video.fps));
1126 } else { 1137 } else {
1127 capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( 1138 capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile(
1128 test::ResourcePath(params_.video.clip_name, "yuv"), 1139 test::ResourcePath(params_.video.clip_name, "yuv"),
1129 params_.common.width, params_.common.height, params_.common.fps, 1140 params_.video.width, params_.video.height, params_.video.fps,
1130 clock_)); 1141 clock_));
1131 ASSERT_TRUE(capturer_) << "Could not create capturer for " 1142 ASSERT_TRUE(capturer_) << "Could not create capturer for "
1132 << params_.video.clip_name 1143 << params_.video.clip_name
1133 << ".yuv. Is this resource file present?"; 1144 << ".yuv. Is this resource file present?";
1134 } 1145 }
1135 } 1146 }
1136 } 1147 }
1137 1148
1138 void VideoQualityTest::RunWithAnalyzer(const Params& params) { 1149 void VideoQualityTest::RunWithAnalyzer(const Params& params) {
1139 params_ = params; 1150 params_ = params;
1140 1151
1141 RTC_CHECK(!params_.audio); 1152 RTC_CHECK(!params_.audio.enabled);
1142 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to 1153 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to
1143 // differentiate between the analyzer and the renderer case. 1154 // differentiate between the analyzer and the renderer case.
1144 CheckParams(); 1155 CheckParams();
1145 1156
1146 FILE* graph_data_output_file = nullptr; 1157 FILE* graph_data_output_file = nullptr;
1147 if (!params_.analyzer.graph_data_output_filename.empty()) { 1158 if (!params_.analyzer.graph_data_output_filename.empty()) {
1148 graph_data_output_file = 1159 graph_data_output_file =
1149 fopen(params_.analyzer.graph_data_output_filename.c_str(), "w"); 1160 fopen(params_.analyzer.graph_data_output_filename.c_str(), "w");
1150 RTC_CHECK(graph_data_output_file) 1161 RTC_CHECK(graph_data_output_file)
1151 << "Can't open the file " << params_.analyzer.graph_data_output_filename 1162 << "Can't open the file " << params_.analyzer.graph_data_output_filename
1152 << "!"; 1163 << "!";
1153 } 1164 }
1154 1165
1155 webrtc::RtcEventLogNullImpl event_log; 1166 webrtc::RtcEventLogNullImpl event_log;
1156 Call::Config call_config(&event_log_); 1167 Call::Config call_config(&event_log_);
1157 call_config.bitrate_config = params.common.call_bitrate_config; 1168 call_config.bitrate_config = params.call.call_bitrate_config;
1158 CreateCalls(call_config, call_config); 1169 CreateCalls(call_config, call_config);
1159 1170
1160 test::LayerFilteringTransport send_transport( 1171 test::LayerFilteringTransport send_transport(
1161 params.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1172 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1162 params.common.selected_tl, params_.ss.selected_sl); 1173 params_.video.selected_tl, params_.ss.selected_sl);
1163 test::DirectTransport recv_transport(params.pipe, receiver_call_.get()); 1174 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get());
1164 1175
1165 std::string graph_title = params_.analyzer.graph_title; 1176 std::string graph_title = params_.analyzer.graph_title;
1166 if (graph_title.empty()) 1177 if (graph_title.empty())
1167 graph_title = VideoQualityTest::GenerateGraphTitle(); 1178 graph_title = VideoQualityTest::GenerateGraphTitle();
1168 1179
1169 // In the case of different resolutions, the functions calculating PSNR and 1180 // In the case of different resolutions, the functions calculating PSNR and
1170 // SSIM return -1.0, instead of a positive value as usual. VideoAnalyzer 1181 // SSIM return -1.0, instead of a positive value as usual. VideoAnalyzer
1171 // aborts if the average psnr/ssim are below the given threshold, which is 1182 // aborts if the average psnr/ssim are below the given threshold, which is
1172 // 0.0 by default. Setting the thresholds to -1.1 prevents the unnecessary 1183 // 0.0 by default. Setting the thresholds to -1.1 prevents the unnecessary
1173 // abort. 1184 // abort.
1174 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; 1185 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream];
1175 int selected_sl = params_.ss.selected_sl != -1 1186 int selected_sl = params_.ss.selected_sl != -1
1176 ? params_.ss.selected_sl 1187 ? params_.ss.selected_sl
1177 : params_.ss.num_spatial_layers - 1; 1188 : params_.ss.num_spatial_layers - 1;
1178 bool disable_quality_check = 1189 bool disable_quality_check =
1179 selected_stream.width != params_.common.width || 1190 selected_stream.width != params_.video.width ||
1180 selected_stream.height != params_.common.height || 1191 selected_stream.height != params_.video.height ||
1181 (!params_.ss.spatial_layers.empty() && 1192 (!params_.ss.spatial_layers.empty() &&
1182 params_.ss.spatial_layers[selected_sl].scaling_factor_num != 1193 params_.ss.spatial_layers[selected_sl].scaling_factor_num !=
1183 params_.ss.spatial_layers[selected_sl].scaling_factor_den); 1194 params_.ss.spatial_layers[selected_sl].scaling_factor_den);
1184 if (disable_quality_check) { 1195 if (disable_quality_check) {
1185 fprintf(stderr, 1196 fprintf(stderr,
1186 "Warning: Calculating PSNR and SSIM for downsized resolution " 1197 "Warning: Calculating PSNR and SSIM for downsized resolution "
1187 "not implemented yet! Skipping PSNR and SSIM calculations!"); 1198 "not implemented yet! Skipping PSNR and SSIM calculations!");
1188 } 1199 }
1189 1200
1190 VideoAnalyzer analyzer( 1201 VideoAnalyzer analyzer(
1191 &send_transport, params_.analyzer.test_label, 1202 &send_transport, params_.analyzer.test_label,
1192 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, 1203 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold,
1193 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, 1204 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold,
1194 params_.analyzer.test_durations_secs * params_.common.fps, 1205 params_.analyzer.test_durations_secs * params_.video.fps,
1195 graph_data_output_file, graph_title, 1206 graph_data_output_file, graph_title,
1196 kVideoSendSsrcs[params_.ss.selected_stream]); 1207 kVideoSendSsrcs[params_.ss.selected_stream]);
1197 1208
1198 analyzer.SetReceiver(receiver_call_->Receiver()); 1209 analyzer.SetReceiver(receiver_call_->Receiver());
1199 send_transport.SetReceiver(&analyzer); 1210 send_transport.SetReceiver(&analyzer);
1200 recv_transport.SetReceiver(sender_call_->Receiver()); 1211 recv_transport.SetReceiver(sender_call_->Receiver());
1201 1212
1202 SetupCommon(&analyzer, &recv_transport); 1213 SetupCommon(&analyzer, &recv_transport);
1203 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; 1214 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer;
1204 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); 1215 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 1250
1240 if (graph_data_output_file) 1251 if (graph_data_output_file)
1241 fclose(graph_data_output_file); 1252 fclose(graph_data_output_file);
1242 } 1253 }
1243 1254
1244 void VideoQualityTest::RunWithRenderers(const Params& params) { 1255 void VideoQualityTest::RunWithRenderers(const Params& params) {
1245 params_ = params; 1256 params_ = params;
1246 CheckParams(); 1257 CheckParams();
1247 1258
1248 std::unique_ptr<test::VideoRenderer> local_preview( 1259 std::unique_ptr<test::VideoRenderer> local_preview(
1249 test::VideoRenderer::Create("Local Preview", params_.common.width, 1260 test::VideoRenderer::Create("Local Preview", params_.video.width,
1250 params_.common.height)); 1261 params_.video.height));
1251 size_t stream_id = params_.ss.selected_stream; 1262 size_t stream_id = params_.ss.selected_stream;
1252 std::string title = "Loopback Video"; 1263 std::string title = "Loopback Video";
1253 if (params_.ss.streams.size() > 1) { 1264 if (params_.ss.streams.size() > 1) {
1254 std::ostringstream s; 1265 std::ostringstream s;
1255 s << stream_id; 1266 s << stream_id;
1256 title += " - Stream #" + s.str(); 1267 title += " - Stream #" + s.str();
1257 } 1268 }
1258 1269
1259 std::unique_ptr<test::VideoRenderer> loopback_video( 1270 std::unique_ptr<test::VideoRenderer> loopback_video(
1260 test::VideoRenderer::Create(title.c_str(), 1271 test::VideoRenderer::Create(title.c_str(),
1261 params_.ss.streams[stream_id].width, 1272 params_.ss.streams[stream_id].width,
1262 params_.ss.streams[stream_id].height)); 1273 params_.ss.streams[stream_id].height));
1263 1274
1264 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to 1275 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to
1265 // match the full stack tests. 1276 // match the full stack tests.
1266 webrtc::RtcEventLogNullImpl event_log; 1277 webrtc::RtcEventLogNullImpl event_log;
1267 Call::Config call_config(&event_log_); 1278 Call::Config call_config(&event_log_);
1268 call_config.bitrate_config = params_.common.call_bitrate_config; 1279 call_config.bitrate_config = params_.call.call_bitrate_config;
1269 1280
1270 ::VoiceEngineState voe; 1281 ::VoiceEngineState voe;
1271 if (params_.audio) { 1282 if (params_.audio.enabled) {
1272 CreateVoiceEngine(&voe, decoder_factory_); 1283 CreateVoiceEngine(&voe, decoder_factory_);
1273 AudioState::Config audio_state_config; 1284 AudioState::Config audio_state_config;
1274 audio_state_config.voice_engine = voe.voice_engine; 1285 audio_state_config.voice_engine = voe.voice_engine;
1275 call_config.audio_state = AudioState::Create(audio_state_config); 1286 call_config.audio_state = AudioState::Create(audio_state_config);
1276 } 1287 }
1277 1288
1278 std::unique_ptr<Call> call(Call::Create(call_config)); 1289 std::unique_ptr<Call> call(Call::Create(call_config));
1279 1290
1280 test::LayerFilteringTransport transport( 1291 test::LayerFilteringTransport transport(
1281 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1292 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1282 params.common.selected_tl, params_.ss.selected_sl); 1293 params.video.selected_tl, params_.ss.selected_sl);
1283 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at 1294 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at
1284 // least share as much code as possible. That way this test would also match 1295 // least share as much code as possible. That way this test would also match
1285 // the full stack tests better. 1296 // the full stack tests better.
1286 transport.SetReceiver(call->Receiver()); 1297 transport.SetReceiver(call->Receiver());
1287 1298
1288 SetupCommon(&transport, &transport); 1299 SetupCommon(&transport, &transport);
1289 1300
1290 video_send_config_.pre_encode_callback = local_preview.get(); 1301 video_send_config_.pre_encode_callback = local_preview.get();
1291 video_receive_configs_[stream_id].renderer = loopback_video.get(); 1302 video_receive_configs_[stream_id].renderer = loopback_video.get();
1292 if (params_.audio && params_.audio_video_sync) 1303 if (params_.audio.enabled && params_.audio.sync_video)
1293 video_receive_configs_[stream_id].sync_group = kSyncGroup; 1304 video_receive_configs_[stream_id].sync_group = kSyncGroup;
1294 1305
1295 video_send_config_.suspend_below_min_bitrate = 1306 video_send_config_.suspend_below_min_bitrate =
1296 params_.common.suspend_below_min_bitrate; 1307 params_.video.suspend_below_min_bitrate;
1297 1308
1298 if (params.common.fec) { 1309 if (params.video.fec) {
1299 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; 1310 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType;
1300 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; 1311 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
1301 video_receive_configs_[stream_id].rtp.ulpfec.red_payload_type = 1312 video_receive_configs_[stream_id].rtp.ulpfec.red_payload_type =
1302 kRedPayloadType; 1313 kRedPayloadType;
1303 video_receive_configs_[stream_id].rtp.ulpfec.ulpfec_payload_type = 1314 video_receive_configs_[stream_id].rtp.ulpfec.ulpfec_payload_type =
1304 kUlpfecPayloadType; 1315 kUlpfecPayloadType;
1305 } 1316 }
1306 1317
1307 if (params_.screenshare.enabled) 1318 if (params_.screenshare.enabled)
1308 SetupScreenshare(); 1319 SetupScreenshare();
1309 1320
1310 video_send_stream_ = call->CreateVideoSendStream( 1321 video_send_stream_ = call->CreateVideoSendStream(
1311 video_send_config_.Copy(), video_encoder_config_.Copy()); 1322 video_send_config_.Copy(), video_encoder_config_.Copy());
1312 VideoReceiveStream* video_receive_stream = 1323 VideoReceiveStream* video_receive_stream =
1313 call->CreateVideoReceiveStream(video_receive_configs_[stream_id].Copy()); 1324 call->CreateVideoReceiveStream(video_receive_configs_[stream_id].Copy());
1314 CreateCapturer(); 1325 CreateCapturer();
1315 video_send_stream_->SetSource(capturer_.get()); 1326 video_send_stream_->SetSource(capturer_.get());
1316 1327
1317 AudioReceiveStream* audio_receive_stream = nullptr; 1328 AudioReceiveStream* audio_receive_stream = nullptr;
1318 if (params_.audio) { 1329 if (params_.audio.enabled) {
1319 audio_send_config_ = AudioSendStream::Config(&transport); 1330 audio_send_config_ = AudioSendStream::Config(&transport);
1320 audio_send_config_.voe_channel_id = voe.send_channel_id; 1331 audio_send_config_.voe_channel_id = voe.send_channel_id;
1321 audio_send_config_.rtp.ssrc = kAudioSendSsrc; 1332 audio_send_config_.rtp.ssrc = kAudioSendSsrc;
1322 1333
1323 // Add extension to enable audio send side BWE, and allow audio bit rate 1334 // Add extension to enable audio send side BWE, and allow audio bit rate
1324 // adaptation. 1335 // adaptation.
1325 audio_send_config_.rtp.extensions.clear(); 1336 audio_send_config_.rtp.extensions.clear();
1326 if (params_.common.send_side_bwe) { 1337 if (params_.call.send_side_bwe) {
1327 audio_send_config_.rtp.extensions.push_back(webrtc::RtpExtension( 1338 audio_send_config_.rtp.extensions.push_back(webrtc::RtpExtension(
1328 webrtc::RtpExtension::kTransportSequenceNumberUri, 1339 webrtc::RtpExtension::kTransportSequenceNumberUri,
1329 test::kTransportSequenceNumberExtensionId)); 1340 test::kTransportSequenceNumberExtensionId));
1330 audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000; 1341 audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000;
1331 audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000; 1342 audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000;
1332 } 1343 }
1333 1344
1334 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); 1345 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_);
1335 1346
1336 AudioReceiveStream::Config audio_config; 1347 AudioReceiveStream::Config audio_config;
1337 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 1348 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
1338 audio_config.rtcp_send_transport = &transport; 1349 audio_config.rtcp_send_transport = &transport;
1339 audio_config.voe_channel_id = voe.receive_channel_id; 1350 audio_config.voe_channel_id = voe.receive_channel_id;
1340 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 1351 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
1341 audio_config.rtp.transport_cc = params_.common.send_side_bwe; 1352 audio_config.rtp.transport_cc = params_.call.send_side_bwe;
1342 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; 1353 audio_config.rtp.extensions = audio_send_config_.rtp.extensions;
1343 audio_config.decoder_factory = decoder_factory_; 1354 audio_config.decoder_factory = decoder_factory_;
1344 if (params_.audio_video_sync) 1355 if (params_.audio.sync_video)
1345 audio_config.sync_group = kSyncGroup; 1356 audio_config.sync_group = kSyncGroup;
1346 1357
1347 audio_receive_stream = call->CreateAudioReceiveStream(audio_config); 1358 audio_receive_stream = call->CreateAudioReceiveStream(audio_config);
1348 1359
1349 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000}; 1360 const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000};
1350 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst)); 1361 EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst));
1351 } 1362 }
1352 1363
1353 StartEncodedFrameLogs(video_receive_stream); 1364 StartEncodedFrameLogs(video_receive_stream);
1354 StartEncodedFrameLogs(video_send_stream_); 1365 StartEncodedFrameLogs(video_send_stream_);
1355 1366
1356 // Start sending and receiving video. 1367 // Start sending and receiving video.
1357 video_receive_stream->Start(); 1368 video_receive_stream->Start();
1358 video_send_stream_->Start(); 1369 video_send_stream_->Start();
1359 capturer_->Start(); 1370 capturer_->Start();
1360 1371
1361 if (params_.audio) { 1372 if (params_.audio.enabled) {
1362 // Start receiving audio. 1373 // Start receiving audio.
1363 audio_receive_stream->Start(); 1374 audio_receive_stream->Start();
1364 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); 1375 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id));
1365 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id)); 1376 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id));
1366 1377
1367 // Start sending audio. 1378 // Start sending audio.
1368 audio_send_stream_->Start(); 1379 audio_send_stream_->Start();
1369 EXPECT_EQ(0, voe.base->StartSend(voe.send_channel_id)); 1380 EXPECT_EQ(0, voe.base->StartSend(voe.send_channel_id));
1370 } 1381 }
1371 1382
1372 test::PressEnterToContinue(); 1383 test::PressEnterToContinue();
1373 1384
1374 if (params_.audio) { 1385 if (params_.audio.enabled) {
1375 // Stop sending audio. 1386 // Stop sending audio.
1376 EXPECT_EQ(0, voe.base->StopSend(voe.send_channel_id)); 1387 EXPECT_EQ(0, voe.base->StopSend(voe.send_channel_id));
1377 audio_send_stream_->Stop(); 1388 audio_send_stream_->Stop();
1378 1389
1379 // Stop receiving audio. 1390 // Stop receiving audio.
1380 EXPECT_EQ(0, voe.base->StopReceive(voe.receive_channel_id)); 1391 EXPECT_EQ(0, voe.base->StopReceive(voe.receive_channel_id));
1381 EXPECT_EQ(0, voe.base->StopPlayout(voe.receive_channel_id)); 1392 EXPECT_EQ(0, voe.base->StopPlayout(voe.receive_channel_id));
1382 audio_receive_stream->Stop(); 1393 audio_receive_stream->Stop();
1383 } 1394 }
1384 1395
1385 // Stop receiving and sending video. 1396 // Stop receiving and sending video.
1386 capturer_->Stop(); 1397 capturer_->Stop();
1387 video_send_stream_->Stop(); 1398 video_send_stream_->Stop();
1388 video_receive_stream->Stop(); 1399 video_receive_stream->Stop();
1389 1400
1390 call->DestroyVideoReceiveStream(video_receive_stream); 1401 call->DestroyVideoReceiveStream(video_receive_stream);
1391 call->DestroyVideoSendStream(video_send_stream_); 1402 call->DestroyVideoSendStream(video_send_stream_);
1392 1403
1393 if (params_.audio) { 1404 if (params_.audio.enabled) {
1394 call->DestroyAudioSendStream(audio_send_stream_); 1405 call->DestroyAudioSendStream(audio_send_stream_);
1395 call->DestroyAudioReceiveStream(audio_receive_stream); 1406 call->DestroyAudioReceiveStream(audio_receive_stream);
1396 } 1407 }
1397 1408
1398 transport.StopSending(); 1409 transport.StopSending();
1399 if (params_.audio) 1410 if (params_.audio.enabled)
1400 DestroyVoiceEngine(&voe); 1411 DestroyVoiceEngine(&voe);
1401 } 1412 }
1402 1413
1403 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { 1414 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) {
1404 if (!params_.common.encoded_frame_base_path.empty()) { 1415 if (!params_.video.encoded_frame_base_path.empty()) {
1405 std::ostringstream str; 1416 std::ostringstream str;
1406 str << send_logs_++; 1417 str << send_logs_++;
1407 std::string prefix = 1418 std::string prefix =
1408 params_.common.encoded_frame_base_path + "." + str.str() + ".send."; 1419 params_.video.encoded_frame_base_path + "." + str.str() + ".send.";
1409 stream->EnableEncodedFrameRecording( 1420 stream->EnableEncodedFrameRecording(
1410 std::vector<rtc::PlatformFile>( 1421 std::vector<rtc::PlatformFile>(
1411 {rtc::CreatePlatformFile(prefix + "1.ivf"), 1422 {rtc::CreatePlatformFile(prefix + "1.ivf"),
1412 rtc::CreatePlatformFile(prefix + "2.ivf"), 1423 rtc::CreatePlatformFile(prefix + "2.ivf"),
1413 rtc::CreatePlatformFile(prefix + "3.ivf")}), 1424 rtc::CreatePlatformFile(prefix + "3.ivf")}),
1414 10000000); 1425 10000000);
1415 } 1426 }
1416 } 1427 }
1417 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) { 1428 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) {
1418 if (!params_.common.encoded_frame_base_path.empty()) { 1429 if (!params_.video.encoded_frame_base_path.empty()) {
1419 std::ostringstream str; 1430 std::ostringstream str;
1420 str << receive_logs_++; 1431 str << receive_logs_++;
1421 std::string path = 1432 std::string path =
1422 params_.common.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 1433 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1423 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 1434 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1424 10000000); 1435 10000000);
1425 } 1436 }
1426 } 1437 }
1427 1438
1428 } // namespace webrtc 1439 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698