| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include "webrtc/video/video_quality_test.h" | 10 #include "webrtc/video/video_quality_test.h" |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 layer.target_bitrate_bps = v[2]; | 1011 layer.target_bitrate_bps = v[2]; |
| 1012 params->ss.spatial_layers.push_back(layer); | 1012 params->ss.spatial_layers.push_back(layer); |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void VideoQualityTest::SetupVideo(Transport* send_transport, | 1016 void VideoQualityTest::SetupVideo(Transport* send_transport, |
| 1017 Transport* recv_transport) { | 1017 Transport* recv_transport) { |
| 1018 if (params_.logs) | 1018 if (params_.logs) |
| 1019 trace_to_stderr_.reset(new test::TraceToStderr); | 1019 trace_to_stderr_.reset(new test::TraceToStderr); |
| 1020 | 1020 |
| 1021 size_t num_streams = params_.ss.streams.size(); | 1021 size_t num_video_streams = params_.ss.streams.size(); |
| 1022 CreateSendConfig(num_streams, 0, 0, send_transport); | 1022 size_t num_flexfec_streams = params_.video.flexfec ? 1 : 0; |
| 1023 CreateSendConfig(num_video_streams, 0, num_flexfec_streams, send_transport); |
| 1023 | 1024 |
| 1024 int payload_type; | 1025 int payload_type; |
| 1025 if (params_.video.codec == "H264") { | 1026 if (params_.video.codec == "H264") { |
| 1026 video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264"))); | 1027 video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264"))); |
| 1027 payload_type = kPayloadTypeH264; | 1028 payload_type = kPayloadTypeH264; |
| 1028 } else if (params_.video.codec == "VP8") { | 1029 } else if (params_.video.codec == "VP8") { |
| 1029 video_encoder_.reset(VP8Encoder::Create()); | 1030 video_encoder_.reset(VP8Encoder::Create()); |
| 1030 payload_type = kPayloadTypeVP8; | 1031 payload_type = kPayloadTypeVP8; |
| 1031 } else if (params_.video.codec == "VP9") { | 1032 } else if (params_.video.codec == "VP9") { |
| 1032 video_encoder_.reset(VP9Encoder::Create()); | 1033 video_encoder_.reset(VP9Encoder::Create()); |
| 1033 payload_type = kPayloadTypeVP9; | 1034 payload_type = kPayloadTypeVP9; |
| 1034 } else { | 1035 } else { |
| 1035 RTC_NOTREACHED() << "Codec not supported!"; | 1036 RTC_NOTREACHED() << "Codec not supported!"; |
| 1036 return; | 1037 return; |
| 1037 } | 1038 } |
| 1038 video_send_config_.encoder_settings.encoder = video_encoder_.get(); | 1039 video_send_config_.encoder_settings.encoder = video_encoder_.get(); |
| 1039 video_send_config_.encoder_settings.payload_name = params_.video.codec; | 1040 video_send_config_.encoder_settings.payload_name = params_.video.codec; |
| 1040 video_send_config_.encoder_settings.payload_type = payload_type; | 1041 video_send_config_.encoder_settings.payload_type = payload_type; |
| 1041 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1042 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 1042 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; | 1043 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; |
| 1043 for (size_t i = 0; i < num_streams; ++i) | 1044 for (size_t i = 0; i < num_video_streams; ++i) |
| 1044 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); | 1045 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); |
| 1045 | 1046 |
| 1046 video_send_config_.rtp.extensions.clear(); | 1047 video_send_config_.rtp.extensions.clear(); |
| 1047 if (params_.call.send_side_bwe) { | 1048 if (params_.call.send_side_bwe) { |
| 1048 video_send_config_.rtp.extensions.push_back( | 1049 video_send_config_.rtp.extensions.push_back( |
| 1049 RtpExtension(RtpExtension::kTransportSequenceNumberUri, | 1050 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
| 1050 test::kTransportSequenceNumberExtensionId)); | 1051 test::kTransportSequenceNumberExtensionId)); |
| 1051 } else { | 1052 } else { |
| 1052 video_send_config_.rtp.extensions.push_back(RtpExtension( | 1053 video_send_config_.rtp.extensions.push_back(RtpExtension( |
| 1053 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); | 1054 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1065 video_encoder_config_.max_bitrate_bps += | 1066 video_encoder_config_.max_bitrate_bps += |
| 1066 params_.ss.streams[i].max_bitrate_bps; | 1067 params_.ss.streams[i].max_bitrate_bps; |
| 1067 } | 1068 } |
| 1068 video_encoder_config_.video_stream_factory = | 1069 video_encoder_config_.video_stream_factory = |
| 1069 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); | 1070 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); |
| 1070 | 1071 |
| 1071 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; | 1072 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; |
| 1072 | 1073 |
| 1073 CreateMatchingReceiveConfigs(recv_transport); | 1074 CreateMatchingReceiveConfigs(recv_transport); |
| 1074 | 1075 |
| 1075 for (size_t i = 0; i < num_streams; ++i) { | 1076 for (size_t i = 0; i < num_video_streams; ++i) { |
| 1076 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1077 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 1077 video_receive_configs_[i].rtp.rtx[payload_type].ssrc = kSendRtxSsrcs[i]; | 1078 video_receive_configs_[i].rtp.rtx[payload_type].ssrc = kSendRtxSsrcs[i]; |
| 1078 video_receive_configs_[i].rtp.rtx[payload_type].payload_type = | 1079 video_receive_configs_[i].rtp.rtx[payload_type].payload_type = |
| 1079 kSendRtxPayloadType; | 1080 kSendRtxPayloadType; |
| 1080 video_receive_configs_[i].rtp.transport_cc = params_.call.send_side_bwe; | 1081 video_receive_configs_[i].rtp.transport_cc = params_.call.send_side_bwe; |
| 1081 } | 1082 } |
| 1082 | 1083 |
| 1083 if (params_.video.flexfec) { | 1084 if (params_.video.flexfec) { |
| 1084 video_send_config_.rtp.flexfec.flexfec_payload_type = kFlexfecPayloadType; | |
| 1085 video_send_config_.rtp.flexfec.flexfec_ssrc = kFlexfecSendSsrc; | |
| 1086 video_send_config_.rtp.flexfec.protected_media_ssrcs = { | 1085 video_send_config_.rtp.flexfec.protected_media_ssrcs = { |
| 1087 kVideoSendSsrcs[params_.ss.selected_stream]}; | 1086 kVideoSendSsrcs[params_.ss.selected_stream]}; |
| 1088 | 1087 |
| 1089 FlexfecReceiveStream::Config flexfec_receive_config; | 1088 RTC_DCHECK(!flexfec_receive_configs_.empty()); |
| 1090 flexfec_receive_config.payload_type = | 1089 flexfec_receive_configs_[0].protected_media_ssrcs = |
| 1091 video_send_config_.rtp.flexfec.flexfec_payload_type; | |
| 1092 flexfec_receive_config.remote_ssrc = | |
| 1093 video_send_config_.rtp.flexfec.flexfec_ssrc; | |
| 1094 flexfec_receive_config.protected_media_ssrcs = | |
| 1095 video_send_config_.rtp.flexfec.protected_media_ssrcs; | 1090 video_send_config_.rtp.flexfec.protected_media_ssrcs; |
| 1096 flexfec_receive_configs_.push_back(flexfec_receive_config); | |
| 1097 } | 1091 } |
| 1098 | 1092 |
| 1099 if (params_.video.ulpfec) { | 1093 if (params_.video.ulpfec) { |
| 1100 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; | 1094 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 1101 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; | 1095 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 1102 video_send_config_.rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType; | 1096 video_send_config_.rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType; |
| 1103 | 1097 |
| 1104 video_receive_configs_[params_.ss.selected_stream] | 1098 video_receive_configs_[params_.ss.selected_stream] |
| 1105 .rtp.ulpfec.red_payload_type = | 1099 .rtp.ulpfec.red_payload_type = |
| 1106 video_send_config_.rtp.ulpfec.red_payload_type; | 1100 video_send_config_.rtp.ulpfec.red_payload_type; |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 std::ostringstream str; | 1493 std::ostringstream str; |
| 1500 str << receive_logs_++; | 1494 str << receive_logs_++; |
| 1501 std::string path = | 1495 std::string path = |
| 1502 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1496 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1503 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1497 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1504 10000000); | 1498 10000000); |
| 1505 } | 1499 } |
| 1506 } | 1500 } |
| 1507 | 1501 |
| 1508 } // namespace webrtc | 1502 } // namespace webrtc |
| OLD | NEW |