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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 RTC_CHECK_GT(v[2], 0); | 988 RTC_CHECK_GT(v[2], 0); |
989 | 989 |
990 SpatialLayer layer; | 990 SpatialLayer layer; |
991 layer.scaling_factor_num = v[0] == -1 ? 1 : v[0]; | 991 layer.scaling_factor_num = v[0] == -1 ? 1 : v[0]; |
992 layer.scaling_factor_den = v[1] == -1 ? 1 : v[1]; | 992 layer.scaling_factor_den = v[1] == -1 ? 1 : v[1]; |
993 layer.target_bitrate_bps = v[2]; | 993 layer.target_bitrate_bps = v[2]; |
994 params->ss.spatial_layers.push_back(layer); | 994 params->ss.spatial_layers.push_back(layer); |
995 } | 995 } |
996 } | 996 } |
997 | 997 |
998 void VideoQualityTest::SetupCommon(Transport* send_transport, | 998 void VideoQualityTest::SetupVideo(Transport* send_transport, |
999 Transport* recv_transport) { | 999 Transport* recv_transport) { |
1000 if (params_.logs) | 1000 if (params_.logs) |
1001 trace_to_stderr_.reset(new test::TraceToStderr); | 1001 trace_to_stderr_.reset(new test::TraceToStderr); |
1002 | 1002 |
1003 size_t num_streams = params_.ss.streams.size(); | 1003 size_t num_streams = params_.ss.streams.size(); |
1004 CreateSendConfig(num_streams, 0, send_transport); | 1004 CreateSendConfig(num_streams, 0, send_transport); |
1005 | 1005 |
1006 int payload_type; | 1006 int payload_type; |
1007 if (params_.video.codec == "H264") { | 1007 if (params_.video.codec == "H264") { |
1008 encoder_.reset(VideoEncoder::Create(VideoEncoder::kH264)); | 1008 video_encoder_.reset(VideoEncoder::Create(VideoEncoder::kH264)); |
1009 payload_type = kPayloadTypeH264; | 1009 payload_type = kPayloadTypeH264; |
1010 } else if (params_.video.codec == "VP8") { | 1010 } else if (params_.video.codec == "VP8") { |
1011 encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp8)); | 1011 video_encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp8)); |
1012 payload_type = kPayloadTypeVP8; | 1012 payload_type = kPayloadTypeVP8; |
1013 } else if (params_.video.codec == "VP9") { | 1013 } else if (params_.video.codec == "VP9") { |
1014 encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp9)); | 1014 video_encoder_.reset(VideoEncoder::Create(VideoEncoder::kVp9)); |
1015 payload_type = kPayloadTypeVP9; | 1015 payload_type = kPayloadTypeVP9; |
1016 } else { | 1016 } else { |
1017 RTC_NOTREACHED() << "Codec not supported!"; | 1017 RTC_NOTREACHED() << "Codec not supported!"; |
1018 return; | 1018 return; |
1019 } | 1019 } |
1020 video_send_config_.encoder_settings.encoder = encoder_.get(); | 1020 video_send_config_.encoder_settings.encoder = video_encoder_.get(); |
1021 video_send_config_.encoder_settings.payload_name = params_.video.codec; | 1021 video_send_config_.encoder_settings.payload_name = params_.video.codec; |
1022 video_send_config_.encoder_settings.payload_type = payload_type; | 1022 video_send_config_.encoder_settings.payload_type = payload_type; |
1023 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1023 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1024 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; | 1024 video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; |
1025 for (size_t i = 0; i < num_streams; ++i) | 1025 for (size_t i = 0; i < num_streams; ++i) |
1026 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); | 1026 video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]); |
1027 | 1027 |
1028 video_send_config_.rtp.extensions.clear(); | 1028 video_send_config_.rtp.extensions.clear(); |
1029 if (params_.call.send_side_bwe) { | 1029 if (params_.call.send_side_bwe) { |
1030 video_send_config_.rtp.extensions.push_back( | 1030 video_send_config_.rtp.extensions.push_back( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1116 kPauseDurationMs)); | 1116 kPauseDurationMs)); |
1117 } | 1117 } |
1118 } | 1118 } |
1119 | 1119 |
1120 void VideoQualityTest::CreateCapturer() { | 1120 void VideoQualityTest::CreateCapturer() { |
1121 if (params_.screenshare.enabled) { | 1121 if (params_.screenshare.enabled) { |
1122 test::FrameGeneratorCapturer* frame_generator_capturer = | 1122 test::FrameGeneratorCapturer* frame_generator_capturer = |
1123 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), | 1123 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), |
1124 params_.video.fps); | 1124 params_.video.fps); |
1125 EXPECT_TRUE(frame_generator_capturer->Init()); | 1125 EXPECT_TRUE(frame_generator_capturer->Init()); |
1126 capturer_.reset(frame_generator_capturer); | 1126 video_capturer_.reset(frame_generator_capturer); |
1127 } else { | 1127 } else { |
1128 if (params_.video.clip_name.empty()) { | 1128 if (params_.video.clip_name.empty()) { |
1129 capturer_.reset(test::VcmCapturer::Create( | 1129 video_capturer_.reset(test::VcmCapturer::Create( |
1130 params_.video.width, params_.video.height, params_.video.fps)); | 1130 params_.video.width, params_.video.height, params_.video.fps)); |
1131 } else { | 1131 } else { |
1132 capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( | 1132 video_capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( |
1133 test::ResourcePath(params_.video.clip_name, "yuv"), | 1133 test::ResourcePath(params_.video.clip_name, "yuv"), |
1134 params_.video.width, params_.video.height, params_.video.fps, | 1134 params_.video.width, params_.video.height, params_.video.fps, |
1135 clock_)); | 1135 clock_)); |
1136 ASSERT_TRUE(capturer_) << "Could not create capturer for " | 1136 ASSERT_TRUE(video_capturer_) << "Could not create capturer for " |
1137 << params_.video.clip_name | 1137 << params_.video.clip_name |
1138 << ".yuv. Is this resource file present?"; | 1138 << ".yuv. Is this resource file present?"; |
1139 } | 1139 } |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
1143 void VideoQualityTest::RunWithAnalyzer(const Params& params) { | 1143 void VideoQualityTest::RunWithAnalyzer(const Params& params) { |
1144 params_ = params; | 1144 params_ = params; |
1145 | 1145 |
1146 RTC_CHECK(!params_.audio.enabled); | 1146 RTC_CHECK(!params_.audio.enabled); |
1147 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to | 1147 // TODO(ivica): Merge with RunWithRenderer and use a flag / argument to |
1148 // differentiate between the analyzer and the renderer case. | 1148 // differentiate between the analyzer and the renderer case. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1197 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, | 1197 disable_quality_check ? -1.1 : params_.analyzer.avg_psnr_threshold, |
1198 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, | 1198 disable_quality_check ? -1.1 : params_.analyzer.avg_ssim_threshold, |
1199 params_.analyzer.test_durations_secs * params_.video.fps, | 1199 params_.analyzer.test_durations_secs * params_.video.fps, |
1200 graph_data_output_file, graph_title, | 1200 graph_data_output_file, graph_title, |
1201 kVideoSendSsrcs[params_.ss.selected_stream]); | 1201 kVideoSendSsrcs[params_.ss.selected_stream]); |
1202 | 1202 |
1203 analyzer.SetReceiver(receiver_call_->Receiver()); | 1203 analyzer.SetReceiver(receiver_call_->Receiver()); |
1204 send_transport.SetReceiver(&analyzer); | 1204 send_transport.SetReceiver(&analyzer); |
1205 recv_transport.SetReceiver(sender_call_->Receiver()); | 1205 recv_transport.SetReceiver(sender_call_->Receiver()); |
1206 | 1206 |
1207 SetupCommon(&analyzer, &recv_transport); | 1207 SetupVideo(&analyzer, &recv_transport); |
1208 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1208 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
1209 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1209 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
1210 for (auto& config : video_receive_configs_) | 1210 for (auto& config : video_receive_configs_) |
1211 config.pre_decode_callback = &analyzer; | 1211 config.pre_decode_callback = &analyzer; |
1212 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1212 RTC_DCHECK(!video_send_config_.post_encode_callback); |
1213 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1213 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
1214 | 1214 |
1215 if (params_.screenshare.enabled) | 1215 if (params_.screenshare.enabled) |
1216 SetupScreenshare(); | 1216 SetupScreenshare(); |
1217 | 1217 |
1218 CreateVideoStreams(); | 1218 CreateVideoStreams(); |
1219 analyzer.SetSendStream(video_send_stream_); | 1219 analyzer.SetSendStream(video_send_stream_); |
1220 video_send_stream_->SetSource(analyzer.OutputInterface()); | 1220 video_send_stream_->SetSource(analyzer.OutputInterface()); |
1221 | 1221 |
1222 CreateCapturer(); | 1222 CreateCapturer(); |
1223 rtc::VideoSinkWants wants; | 1223 rtc::VideoSinkWants wants; |
1224 capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); | 1224 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); |
1225 | 1225 |
1226 StartEncodedFrameLogs(video_send_stream_); | 1226 StartEncodedFrameLogs(video_send_stream_); |
1227 StartEncodedFrameLogs(video_receive_streams_[0]); | 1227 StartEncodedFrameLogs(video_receive_streams_[0]); |
1228 video_send_stream_->Start(); | 1228 video_send_stream_->Start(); |
1229 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1229 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1230 receive_stream->Start(); | 1230 receive_stream->Start(); |
1231 capturer_->Start(); | 1231 video_capturer_->Start(); |
1232 | 1232 |
1233 analyzer.Wait(); | 1233 analyzer.Wait(); |
1234 | 1234 |
1235 send_transport.StopSending(); | 1235 send_transport.StopSending(); |
1236 recv_transport.StopSending(); | 1236 recv_transport.StopSending(); |
1237 | 1237 |
1238 capturer_->Stop(); | 1238 video_capturer_->Stop(); |
1239 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1239 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1240 receive_stream->Stop(); | 1240 receive_stream->Stop(); |
1241 video_send_stream_->Stop(); | 1241 video_send_stream_->Stop(); |
1242 | 1242 |
1243 DestroyStreams(); | 1243 DestroyStreams(); |
1244 | 1244 |
1245 if (graph_data_output_file) | 1245 if (graph_data_output_file) |
1246 fclose(graph_data_output_file); | 1246 fclose(graph_data_output_file); |
1247 } | 1247 } |
1248 | 1248 |
1249 void VideoQualityTest::SetupAudio(int send_channel_id, | |
1250 int receive_channel_id, | |
1251 Call* call, | |
1252 Transport* transport, | |
1253 AudioReceiveStream** audio_receive_stream) { | |
1254 audio_send_config_ = AudioSendStream::Config(transport); | |
1255 audio_send_config_.voe_channel_id = send_channel_id; | |
1256 audio_send_config_.rtp.ssrc = kAudioSendSsrc; | |
1257 | |
1258 // Add extension to enable audio send side BWE, and allow audio bit rate | |
1259 // adaptation. | |
1260 audio_send_config_.rtp.extensions.clear(); | |
1261 if (params_.call.send_side_bwe) { | |
1262 audio_send_config_.rtp.extensions.push_back( | |
1263 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri, | |
1264 test::kTransportSequenceNumberExtensionId)); | |
1265 audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000; | |
1266 audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000; | |
1267 } | |
1268 audio_send_config_.send_codec_spec.codec_inst = | |
1269 CodecInst{120, "OPUS", 48000, 960, 2, 64000}; | |
1270 | |
1271 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); | |
1272 | |
1273 AudioReceiveStream::Config audio_config; | |
1274 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | |
1275 audio_config.rtcp_send_transport = transport; | |
1276 audio_config.voe_channel_id = receive_channel_id; | |
1277 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | |
1278 audio_config.rtp.transport_cc = params_.call.send_side_bwe; | |
1279 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; | |
1280 audio_config.decoder_factory = decoder_factory_; | |
1281 if (params_.video.enabled && params_.audio.sync_video) | |
1282 audio_config.sync_group = kSyncGroup; | |
1283 | |
1284 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config); | |
1285 } | |
1286 | |
1249 void VideoQualityTest::RunWithRenderers(const Params& params) { | 1287 void VideoQualityTest::RunWithRenderers(const Params& params) { |
1250 params_ = params; | 1288 params_ = params; |
1251 CheckParams(); | 1289 CheckParams(); |
1252 | 1290 |
1253 std::unique_ptr<test::VideoRenderer> local_preview( | |
1254 test::VideoRenderer::Create("Local Preview", params_.video.width, | |
1255 params_.video.height)); | |
1256 size_t stream_id = params_.ss.selected_stream; | |
1257 std::string title = "Loopback Video"; | |
1258 if (params_.ss.streams.size() > 1) { | |
1259 std::ostringstream s; | |
1260 s << stream_id; | |
1261 title += " - Stream #" + s.str(); | |
1262 } | |
1263 | |
1264 std::unique_ptr<test::VideoRenderer> loopback_video( | |
1265 test::VideoRenderer::Create(title.c_str(), | |
1266 params_.ss.streams[stream_id].width, | |
1267 params_.ss.streams[stream_id].height)); | |
1268 | |
1269 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to | 1291 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to |
1270 // match the full stack tests. | 1292 // match the full stack tests. |
1271 webrtc::RtcEventLogNullImpl event_log; | 1293 webrtc::RtcEventLogNullImpl event_log; |
1272 Call::Config call_config(&event_log_); | 1294 Call::Config call_config(&event_log_); |
1273 call_config.bitrate_config = params_.call.call_bitrate_config; | 1295 call_config.bitrate_config = params_.call.call_bitrate_config; |
1274 | 1296 |
1275 ::VoiceEngineState voe; | 1297 ::VoiceEngineState voe; |
1276 if (params_.audio.enabled) { | 1298 if (params_.audio.enabled) { |
1277 CreateVoiceEngine(&voe, decoder_factory_); | 1299 CreateVoiceEngine(&voe, decoder_factory_); |
1278 AudioState::Config audio_state_config; | 1300 AudioState::Config audio_state_config; |
1279 audio_state_config.voice_engine = voe.voice_engine; | 1301 audio_state_config.voice_engine = voe.voice_engine; |
1280 call_config.audio_state = AudioState::Create(audio_state_config); | 1302 call_config.audio_state = AudioState::Create(audio_state_config); |
1281 } | 1303 } |
1282 | 1304 |
1283 std::unique_ptr<Call> call(Call::Create(call_config)); | 1305 std::unique_ptr<Call> call(Call::Create(call_config)); |
1284 | 1306 |
1307 // TODO(minyue): consider if this is a good transport even for audio only | |
1308 // calls. | |
1285 test::LayerFilteringTransport transport( | 1309 test::LayerFilteringTransport transport( |
1286 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1310 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
1287 params.video.selected_tl, params_.ss.selected_sl); | 1311 params.video.selected_tl, params_.ss.selected_sl); |
1288 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at | 1312 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at |
1289 // least share as much code as possible. That way this test would also match | 1313 // least share as much code as possible. That way this test would also match |
1290 // the full stack tests better. | 1314 // the full stack tests better. |
1291 transport.SetReceiver(call->Receiver()); | 1315 transport.SetReceiver(call->Receiver()); |
1292 | 1316 |
1293 SetupCommon(&transport, &transport); | 1317 VideoReceiveStream* video_receive_stream = nullptr; |
1318 std::unique_ptr<test::VideoRenderer> local_preview; | |
1319 std::unique_ptr<test::VideoRenderer> loopback_video; | |
1320 if (params_.video.enabled) { | |
stefan-webrtc
2016/10/31 09:06:56
I'd move everything below to SetupVideo. Maybe the
stefan-webrtc
2016/10/31 09:09:42
Feel free to ignore, I missed the old discussion a
minyue-webrtc
2016/11/01 12:05:50
I think video renderer creation (1321-1335) should
| |
1321 // Create video renders. | |
stefan-webrtc
2016/10/31 09:06:56
video renderers
minyue-webrtc
2016/11/01 12:05:50
Done.
| |
1322 local_preview.reset(test::VideoRenderer::Create( | |
1323 "Local Preview", params_.video.width, params_.video.height)); | |
1294 | 1324 |
1295 video_send_config_.pre_encode_callback = local_preview.get(); | 1325 size_t stream_id = params_.ss.selected_stream; |
1296 video_receive_configs_[stream_id].renderer = loopback_video.get(); | 1326 std::string title = "Loopback Video"; |
1297 if (params_.audio.enabled && params_.audio.sync_video) | 1327 if (params_.ss.streams.size() > 1) { |
1298 video_receive_configs_[stream_id].sync_group = kSyncGroup; | 1328 std::ostringstream s; |
1329 s << stream_id; | |
1330 title += " - Stream #" + s.str(); | |
1331 } | |
1299 | 1332 |
1300 video_send_config_.suspend_below_min_bitrate = | 1333 loopback_video.reset(test::VideoRenderer::Create( |
1301 params_.video.suspend_below_min_bitrate; | 1334 title.c_str(), params_.ss.streams[stream_id].width, |
1335 params_.ss.streams[stream_id].height)); | |
1302 | 1336 |
1303 if (params.video.fec) { | 1337 SetupVideo(&transport, &transport); |
1304 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; | 1338 |
1305 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; | 1339 // TODO(minyue): maybe move the following to SetupVideo() to make code |
1306 video_receive_configs_[stream_id].rtp.ulpfec.red_payload_type = | 1340 // cleaner. |
1307 kRedPayloadType; | 1341 video_send_config_.pre_encode_callback = local_preview.get(); |
1308 video_receive_configs_[stream_id].rtp.ulpfec.ulpfec_payload_type = | 1342 video_receive_configs_[stream_id].renderer = loopback_video.get(); |
1309 kUlpfecPayloadType; | 1343 if (params_.audio.enabled && params_.audio.sync_video) |
1344 video_receive_configs_[stream_id].sync_group = kSyncGroup; | |
1345 | |
1346 video_send_config_.suspend_below_min_bitrate = | |
1347 params_.video.suspend_below_min_bitrate; | |
1348 | |
1349 if (params.video.fec) { | |
1350 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; | |
1351 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; | |
1352 video_receive_configs_[stream_id].rtp.ulpfec.red_payload_type = | |
1353 kRedPayloadType; | |
1354 video_receive_configs_[stream_id].rtp.ulpfec.ulpfec_payload_type = | |
1355 kUlpfecPayloadType; | |
1356 } | |
1357 | |
1358 if (params_.screenshare.enabled) | |
1359 SetupScreenshare(); | |
1360 | |
1361 video_send_stream_ = call->CreateVideoSendStream( | |
1362 video_send_config_.Copy(), video_encoder_config_.Copy()); | |
1363 video_receive_stream = call->CreateVideoReceiveStream( | |
1364 video_receive_configs_[stream_id].Copy()); | |
1365 CreateCapturer(); | |
1366 video_send_stream_->SetSource(video_capturer_.get()); | |
1310 } | 1367 } |
1311 | 1368 |
1312 if (params_.screenshare.enabled) | |
1313 SetupScreenshare(); | |
1314 | |
1315 video_send_stream_ = call->CreateVideoSendStream( | |
1316 video_send_config_.Copy(), video_encoder_config_.Copy()); | |
1317 VideoReceiveStream* video_receive_stream = | |
1318 call->CreateVideoReceiveStream(video_receive_configs_[stream_id].Copy()); | |
1319 CreateCapturer(); | |
1320 video_send_stream_->SetSource(capturer_.get()); | |
1321 | |
1322 AudioReceiveStream* audio_receive_stream = nullptr; | 1369 AudioReceiveStream* audio_receive_stream = nullptr; |
1323 if (params_.audio.enabled) { | 1370 if (params_.audio.enabled) { |
1324 audio_send_config_ = AudioSendStream::Config(&transport); | 1371 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(), |
1325 audio_send_config_.voe_channel_id = voe.send_channel_id; | 1372 &transport, &audio_receive_stream); |
1326 audio_send_config_.rtp.ssrc = kAudioSendSsrc; | |
1327 | |
1328 // Add extension to enable audio send side BWE, and allow audio bit rate | |
1329 // adaptation. | |
1330 audio_send_config_.rtp.extensions.clear(); | |
1331 if (params_.call.send_side_bwe) { | |
1332 audio_send_config_.rtp.extensions.push_back(webrtc::RtpExtension( | |
1333 webrtc::RtpExtension::kTransportSequenceNumberUri, | |
1334 test::kTransportSequenceNumberExtensionId)); | |
1335 audio_send_config_.min_bitrate_kbps = kOpusMinBitrate / 1000; | |
1336 audio_send_config_.max_bitrate_kbps = kOpusBitrateFb / 1000; | |
1337 } | |
1338 audio_send_config_.send_codec_spec.codec_inst = | |
1339 CodecInst{120, "OPUS", 48000, 960, 2, 64000}; | |
1340 | |
1341 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); | |
1342 | |
1343 AudioReceiveStream::Config audio_config; | |
1344 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | |
1345 audio_config.rtcp_send_transport = &transport; | |
1346 audio_config.voe_channel_id = voe.receive_channel_id; | |
1347 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | |
1348 audio_config.rtp.transport_cc = params_.call.send_side_bwe; | |
1349 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; | |
1350 audio_config.decoder_factory = decoder_factory_; | |
1351 if (params_.audio.sync_video) | |
1352 audio_config.sync_group = kSyncGroup; | |
1353 | |
1354 audio_receive_stream = call->CreateAudioReceiveStream(audio_config); | |
1355 } | 1373 } |
1356 | 1374 |
1357 StartEncodedFrameLogs(video_receive_stream); | 1375 StartEncodedFrameLogs(video_receive_stream); |
1358 StartEncodedFrameLogs(video_send_stream_); | 1376 StartEncodedFrameLogs(video_send_stream_); |
1359 | 1377 |
1360 // Start sending and receiving video. | 1378 // Start sending and receiving video. |
1361 video_receive_stream->Start(); | 1379 if (params_.video.enabled) { |
1362 video_send_stream_->Start(); | 1380 video_receive_stream->Start(); |
1363 capturer_->Start(); | 1381 video_send_stream_->Start(); |
1382 video_capturer_->Start(); | |
1383 } | |
1364 | 1384 |
1365 if (params_.audio.enabled) { | 1385 if (params_.audio.enabled) { |
1366 // Start receiving audio. | 1386 // Start receiving audio. |
1367 audio_receive_stream->Start(); | 1387 audio_receive_stream->Start(); |
1368 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); | 1388 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); |
1369 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id)); | 1389 EXPECT_EQ(0, voe.base->StartReceive(voe.receive_channel_id)); |
1370 | 1390 |
1371 // Start sending audio. | 1391 // Start sending audio. |
1372 audio_send_stream_->Start(); | 1392 audio_send_stream_->Start(); |
1373 EXPECT_EQ(0, voe.base->StartSend(voe.send_channel_id)); | 1393 EXPECT_EQ(0, voe.base->StartSend(voe.send_channel_id)); |
1374 } | 1394 } |
1375 | 1395 |
1376 test::PressEnterToContinue(); | 1396 test::PressEnterToContinue(); |
1377 | 1397 |
1378 if (params_.audio.enabled) { | 1398 if (params_.audio.enabled) { |
1379 // Stop sending audio. | 1399 // Stop sending audio. |
1380 EXPECT_EQ(0, voe.base->StopSend(voe.send_channel_id)); | 1400 EXPECT_EQ(0, voe.base->StopSend(voe.send_channel_id)); |
1381 audio_send_stream_->Stop(); | 1401 audio_send_stream_->Stop(); |
1382 | 1402 |
1383 // Stop receiving audio. | 1403 // Stop receiving audio. |
1384 EXPECT_EQ(0, voe.base->StopReceive(voe.receive_channel_id)); | 1404 EXPECT_EQ(0, voe.base->StopReceive(voe.receive_channel_id)); |
1385 EXPECT_EQ(0, voe.base->StopPlayout(voe.receive_channel_id)); | 1405 EXPECT_EQ(0, voe.base->StopPlayout(voe.receive_channel_id)); |
1386 audio_receive_stream->Stop(); | 1406 audio_receive_stream->Stop(); |
1387 } | |
1388 | |
1389 // Stop receiving and sending video. | |
1390 capturer_->Stop(); | |
1391 video_send_stream_->Stop(); | |
1392 video_receive_stream->Stop(); | |
1393 | |
1394 call->DestroyVideoReceiveStream(video_receive_stream); | |
1395 call->DestroyVideoSendStream(video_send_stream_); | |
1396 | |
1397 if (params_.audio.enabled) { | |
1398 call->DestroyAudioSendStream(audio_send_stream_); | 1407 call->DestroyAudioSendStream(audio_send_stream_); |
1399 call->DestroyAudioReceiveStream(audio_receive_stream); | 1408 call->DestroyAudioReceiveStream(audio_receive_stream); |
1400 } | 1409 } |
1401 | 1410 |
1411 // Stop receiving and sending video. | |
1412 if (params_.video.enabled) { | |
1413 video_capturer_->Stop(); | |
1414 video_send_stream_->Stop(); | |
1415 video_receive_stream->Stop(); | |
1416 call->DestroyVideoReceiveStream(video_receive_stream); | |
1417 call->DestroyVideoSendStream(video_send_stream_); | |
1418 } | |
1419 | |
1402 transport.StopSending(); | 1420 transport.StopSending(); |
1403 if (params_.audio.enabled) | 1421 if (params_.audio.enabled) |
1404 DestroyVoiceEngine(&voe); | 1422 DestroyVoiceEngine(&voe); |
1405 } | 1423 } |
1406 | 1424 |
1407 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { | 1425 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { |
1408 if (!params_.video.encoded_frame_base_path.empty()) { | 1426 if (!params_.video.encoded_frame_base_path.empty()) { |
1409 std::ostringstream str; | 1427 std::ostringstream str; |
1410 str << send_logs_++; | 1428 str << send_logs_++; |
1411 std::string prefix = | 1429 std::string prefix = |
(...skipping 11 matching lines...) Expand all Loading... | |
1423 std::ostringstream str; | 1441 std::ostringstream str; |
1424 str << receive_logs_++; | 1442 str << receive_logs_++; |
1425 std::string path = | 1443 std::string path = |
1426 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1444 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1427 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1445 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1428 10000000); | 1446 10000000); |
1429 } | 1447 } |
1430 } | 1448 } |
1431 | 1449 |
1432 } // namespace webrtc | 1450 } // namespace webrtc |
OLD | NEW |