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

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

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

Powered by Google App Engine
This is Rietveld 408576698